Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ColdFusion IsImageFile fails for jpg file

2 jpg images that look exactly the same (failing image above, no.jpg, resaved as yes.png) but one is not an Image according to IsImageFile function.

Run this code

#IsImageFile("http://fdiapp.com/ini/cms/file_uploads/yes.jpg")#
**
#IsImageFile("http://fdiapp.com/ini/cms/file_uploads/no.jpg")#
like image 860
IanOSullivan Avatar asked Oct 23 '22 16:10

IanOSullivan


1 Answers

I think the problem is that is a CMYK jpeg. ColdFusion 9 uses ImageIO internally, which afaik only supports RGB. (While some of the java suggestions in that thread do work from ColdFusion - the colors in the resulting image are skewed.) What is probably happening is that ImageIO fails to even load the image file and that is why IsImageFile returns "no".

FWIW, IsImageFile returns "yes" in ColdFusion 10. However, it still has issues with CMYK. For example if you try and read the image, the final colors are all wrong ...

I think your best bet is to run it through a tool like ImageMagick and convert it to a format ColdFusion can handle properly.

like image 89
Leigh Avatar answered Oct 30 '22 12:10

Leigh