IanOSullivan
IanOSullivan

Reputation: 549

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")#

Upvotes: 5

Views: 1018

Answers (1)

Leigh
Leigh

Reputation: 28873

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.

Upvotes: 3

Related Questions