ColdFusion IsImageFile 对 jpg 文件失败 [英] ColdFusion IsImageFile fails for jpg file

查看:19
本文介绍了ColdFusion IsImageFile 对 jpg 文件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2张看起来完全一样的jpg图片(上面的失败图片,no.jpg,重新保存为yes.png),但根据IsImageFile函数,一张不是Image.

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.

运行这段代码

#IsImageFile("http://fdiapp.com/ini/cms/file_uploads/yes.jpg")#
**
#IsImageFile("http://fdiapp.com/ini/cms/file_uploads/no.jpg")#

推荐答案

我认为问题在于 CMYK jpeg.ColdFusion 9 在内部使用 ImageIO,仅在 支持RGB.(虽然该线程中的一些 java 建议确实可以从 ColdFusion 工作 - 结果图像中的颜色是倾斜的.)可能发生的情况是 ImageIO 甚至无法加载图像文件,这就是为什么IsImageFile 返回否".

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 在 ColdFusion 10 中返回yes".但是,CMYK 仍然存在问题.例如,如果您尝试阅读图像,最终的颜色都是错误的......

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 ...

我认为你最好的办法是通过像 ImageMagick 和将其转换为 ColdFusion 可以正确处理的格式.

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

这篇关于ColdFusion IsImageFile 对 jpg 文件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆