有什么办法可以让PHP判断图片文件是否损坏,无法正常显示?
我已经尝试使用 fopen
检查 URL 是否有效,但没有成功!
最佳答案
Is there any way to have PHP determine whether an image file is broken
如果您所说的损坏是指损坏,则更改为 imagecreatefrom{extension}也无法阅读它们:
if( imagecreatefromjpeg( $yourfile ) !== false ) {
// image is okay.
}
关于php - 有没有办法让 PHP 检测到损坏的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6568247/