Page 1 of 1

Uncaught ImagickException's on readImageFile

Posted: 2018-01-05T02:35:30-07:00
by ashrafs
Hello,

I'm having some problems with an updated ImageMagick installation where `readImageFile` produces a fatal error exception using the PHP API.

I've already had this working while running PHP 5.6 and the associated version of ImageMagick but recently updated to PHP 7.2 and updated the ImageMagick version as well.

I'm fetching an image stream from Amazon S3 with fopen and then reading the image file into ImageMagick using readImageFile:

Code: Select all

$blob = fopen('s3://' . $bucket . '/' . $prePath . urldecode($name), 'r');
$img = new Imagick();
$img->readImageFile($blob);
With a PNG image I'm getting error

Code: Select all

PHP Fatal error:  Uncaught ImagickException: improper image header `/var/tmp/magick-193308zvjjkKvCrJv' @ error/png.c/ReadPNGImage/4229
With a JPG image I'm getting error

Code: Select all

PHP Fatal error:  Uncaught ImagickException: insufficient image data in file `/var/tmp/magick-19454t7LA2q6pVdqv' @ error/jpeg.c/ReadJPEGImage/1106
Running
  • Mac OS X 10.12.6
  • PHP Version 7.2.0RC2
  • Compiled: ImageMagick 7.0.7-15 Q16 x86_64 2017-12-17
  • Running: ImageMagick 7.0.7-18 Q16 x86_64 2017-12-29
  • Imagick Module version: 3.4.3

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-01-05T03:16:45-07:00
by snibgo
I expect the developers will need a test that they can reproduce.