I'm processing a boatload of images (in PHP 7.1) from an external server and most of them are working, but a few of them are not. I open these images separately and open fine in a browser and in Photoshop. These few images will not pass the readImageBlob()
method of Imagick. Quick code:
$img = new Imagick();
if( $image = file_get_contents('http://my.url/image.jpg') !== false ){
try{
$img->readImageBlob( $image );
} catch (Exception $e) {
error_log('failed to open image');
}
}
file_get_contents()
is returning true in both the working images and the erroneous ones.
Without the try/catch in there, this is the error PHP is throwing:
Uncaught ImagickException: no decode delegate for this image format `' @ error/blob.c/BlobToImage/361
Also, when I use the GD library as a fallback method, it processes the image fine.