如何在Perl中验证图像文件?

前端之家收集整理的这篇文章主要介绍了如何在Perl中验证图像文件?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我如何验证jpg文件是否是有效的图像文件.我们正在使用FTP将文件写入目录,但我们似乎在文件写完之前拾取文件,创建无效图像.我需要能够确定何时不再写入.有任何想法吗?

解决方法

最简单的方法可能就是将文件写入临时目录,然后在写入完成后将其移动到真实目录.

或者你可以检查here.

JPEG::Error

[arguments: none] If the file reference remains undefined after a call to new,the file is to be considered not parseable by this module,and one should issue some error message and go to another file. An error message explaining the reason of the failure can be retrieved with the Error method:

编辑:

Image::TestJPG可能会更好.

猜你在找的Perl相关文章