Skip navigation
Currently Being Moderated

Cfimage and jpeg issue

Jan 1, 2010 10:26 AM

I have a serious issue with cfimage... i trying to resize some jpegs.. most of them resizing is a sucess... but in some cases the resizing returns a
error "Unsupported Image Type" although IT IS a jpeg.. i read about CYMK or pjepg or sth like that... does anyone solved this "bug"?

 

Error Message:

 

An exception occurred while trying to read the
image.

 

Unsupported Image Type

 

Stack Trace
at
cfempcp_prod_add_action2ecfm1551070444.runPage(C:\Inetpub\wwwroot\life t\Admin\empcp_prod_add_action.cfm:151)

 

coldfusion.image.ImageReader$ImageReadingException: An exception occurred while trying to read the image.     at
coldfusion.image.ImageReader.readJPEGImage(ImageReader.java:173)
     at
coldfusion.image.ImageReader.readImage(ImageReader.java:96)
     at
coldfusion.image.Image.<init>(Image.java:226)
     at
coldfusion.tagext.io.ImageTag.doStartTag(ImageTag.java:414)
     at
coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2661)

 
Replies
  • Currently Being Moderated
    Jan 1, 2010 9:51 PM   in reply to Zero_Sequence

    Hi Zero_Sequence,

     

    Can you please use isImage()/isImageFile() first, to ensure it is a valid CF image.

     

    isImage(): http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461 172e0811cbec22c24-797b.html

    isImageFile(): http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461 172e0811cbec22c24-7978.html

     

    Thanks!,

    -Aaron Neff

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 2, 2010 6:00 AM   in reply to Zero_Sequence

    Although it is a jpeg file isimage returns false.. the weird part this that ie does not display it right.. is shows only the X like when the pic file is missing...

     

    Hang on... so even IE doesn't think it's a JPG?  Does Firefox?

     

    What makes you think it's a JPG?

     

    What image manipulation software are you using to convert it to/froma JPG?

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 2, 2010 7:12 AM   in reply to Zero_Sequence

    First test.

    <cfset isAnImageFile = false>
    <cfset isAnImage = false>
    <cfif IsImageFile("relative_path_to_image_file")>
        <cfset isAnImageFile = true>
        <cfset img = imageNew("relative_path_to_image_file")>   
        <cfif isImage("img")>
            <cfset isAnImage = true>
            <cfimage action="writeToBrowser" source="#img#">
        </cfif>
    </cfif>
    <p>
    Is an image file: <cfoutput>#isAnImageFile#</cfoutput><br>
    Is an image: <cfoutput>#isAnImage#</cfoutput>
    </p>

     

     

    Second test:

    Can you open the file with an image viewer. An image viewer like IrfanView is quite tolerant. If it fails, the file is most likely corrupt or not an image file.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 3, 2010 8:02 AM   in reply to Zero_Sequence
    it has a .jpeg

    Do you still get an error when you save the file as .jpg?

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 4, 2010 3:21 AM   in reply to Zero_Sequence

    Yeah, i actually can view it using all kind of pic viewers(including firefox and chrome).... so i quess it is not a corrupted file..

     

    Well yes and no.  The internal file structure of a JPG consists of a number of "frames" (not in the video sense of that word, but a data structure sense), and it's entirely likely an invalid or corrupted frame could have gotten into the mix some how, and the JPG will still be "valid" provided the frame offset info is correct.  Some apps might ignore buggered-up frames, some might not.

     

    also it has a .jpeg so i quess its a jpeg...

     

    Well you could rename it to have a .png extension.  That doesn't make it a PNG, that just means it's got the wrong file extension. ;-)

     

    Can you attach one of these files here so I/we can test some code out on it?

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 4, 2010 5:46 AM   in reply to Zero_Sequence
     
    |
    Mark as:
  • Currently Being Moderated
    Jan 5, 2010 6:58 AM   in reply to Daverms

    So did that article work for you? I've run into this before and the solution presented in that blog entry seems reasonable enough.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 19, 2010 2:28 AM   in reply to Zero_Sequence

    1) Raise a bug with Adobe: http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html (and provide a link back to the bug here);

    2) resave the files giving an error using some image-editing software, and reprocess them.  I just used GIMP to resave your file, and it processed fine after that.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 19, 2010 2:59 AM   in reply to Zero_Sequence

    Well, sure, I realise that.  However you seem short on options, so I think it's time you raised it with Adobe.  And if you need to get moving with your project, I think the time's come to think of alternative approaches.

     

    I dunno if it's a bug or just a shortfall either, but if other image-editing software can handle your file, there's no reason we should not expect CF to do so too.  So by bringing this exceptional case to Adobe's attention, they might be able to do something about it.

     

    One problem with my suggestion to raise it on the bug tracker is that one cannot attach files!  I recommend including a link back to this thread where your attachment is.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 19, 2010 8:50 AM   in reply to Zero_Sequence

    The photo attached named SL7006-0417.jpg is of type CMYK.  ColdFusion uses java to process images and java isn't able to handle the cmyk format.  You must open in photoshop or some other program and save as RGB.

     

    I have seen this issue come up a number of times and typically it is because:

     

    1. The image is cmyk (for print) not rgb (for screen/web).  Save as RGB
    2. Someone renamed a file to .jpg (or .gif).  Thinking that if htey renamed .eps to .jpg it makes it a jpg.  Many programs are smart enough to figure this out and show it anyway.  So just opening in FF or some other program isn't a good indication that it really is a jpeg file.
    3. Image is actually corrupt.  Perhaps it didn't ftp all the way or some other issue caused the image to be damaged.
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 21, 2012 12:44 AM   in reply to Joshua Cyr

    Was there ever a fix for it? We have the same issue and it started all of a sudden out of the blue. Using CF 9.01 CFIMAGE seem to just stop working. We resturted the CF Server - even the box with no change

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points