Cfimage and jpeg issue
Copy link to clipboard
Copied
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\lifet\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)
Copy link to clipboard
Copied
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/WSc3ff6d0ea77859461172e0811cbec22c24-797b.html
isImageFile(): http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7978.html
Thanks!,
-Aaron Neff
Copy link to clipboard
Copied
hi itisdesign,
actually that is the issue.
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..
Is there a work around for this problem? i tried to convert it into bmp and then back to jpeg but with no luck..
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.. also it has a .jpeg so i quess its a jpeg...
The weird part its that a company provided me a cd with pictures of their products.... and some of them return false in the isimage function....
Copy link to clipboard
Copied
it has a .jpeg
Do you still get an error when you save the file as .jpg?
Copy link to clipboard
Copied
Yeap...no change...
but when i open it and save for web with photoshop the file is recognized as a picture file from coldfusion function!!!
Copy link to clipboard
Copied
Hi,
Check if this workaround can help you.
http://www.oscararevalo.com/index.cfm/2008/1/26/CFImage-and-PJPEG-Images
Copy link to clipboard
Copied
So did that article work for you? I've run into this before and the solution presented in that blog entry seems reasonable enough.
Copy link to clipboard
Copied
Yes i already tried that solution without any good..
i attach one of the files...
Copy link to clipboard
Copied
Hi to all,
has anyone figured this out?
Thank you, for your time
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
The whole point is to save the time to reprocess the image file...
Actually i dont know if this is really a coldfusion bug or some damaged frame of the image?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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:
- The image is cmyk (for print) not rgb (for screen/web). Save as RGB
- 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.
- Image is actually corrupt. Perhaps it didn't ftp all the way or some other issue caused the image to be damaged.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.

