ColdFusion IsImageFile fails for jpg file

我的未来我决定 提交于 2019-12-04 03:25:58

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/11434403/coldfusion-isimagefile-fails-for-jpg-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!