Page 1 of 1

Uncaught ImagickException's on readImageFile

Posted: 2018-01-03T07:16:55-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
  • Module version: 3.4.3

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-01-03T08:19:58-07:00
by snibgo
You haven't said what version of IMagick you are running. (IMagick isn't ImageMagick, but is simply an interface between PHP and ImageMagick.) Does your version of IMagick work with your current version of ImageMagick?

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-01-03T23:19:31-07:00
by ashrafs
snibgo wrote: 2018-01-03T08:19:58-07:00 You haven't said what version of IMagick you are running. (IMagick isn't ImageMagick, but is simply an interface between PHP and ImageMagick.) Does your version of IMagick work with your current version of ImageMagick?
I added all version details to the bottom of the post. Current version of ImageMagick is 7.0.7-18 Q16 x86_64 2017-12-29.
Imagick version is the module version - 3.4.3_3

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-01-05T01:01:23-07:00
by ashrafs
Anyone?

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-01-05T01:17:57-07:00
by fmw42
try posting to the Bugs forum.

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-01-05T05:14:48-07:00
by Bonzo
It has not been said directly but the people who maintain Imagick are not the people who maintain Imagemagick. I would try and find a dedicated Imagick forum and post there.

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-01-05T07:52:59-07:00
by magick
Bonzo is right. However, if you can reproduce the problem from the command-line, we will investigate. For example, if your image is named image.jpg and this command fails for you:

Code: Select all

convert image.jpg /dev/null
let us know (use 'magick' instead of 'convert' if you are using ImageMagick 7). Post a URL to your image so we can download it and reproduce the problem. Otherwise, you will need to get help from the Imagick developers.

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-01-08T01:18:47-07:00
by ashrafs
No errors with the command line. Thanks for all the responses. Will try and log something with the Imagick team.

Re: Uncaught ImagickException's on readImageFile

Posted: 2018-02-08T03:26:09-07:00
by ashrafs
Hello again. This problem is persisting. The command line of course is not the same as the issue that's being had, which is with readImageFile. I've tried every suggestion but nothing has worked. This could be related to https://github.com/ImageMagick/ImageMagick/issues/945 on Github as I'm getting similar errors. I'm now running the latest version of ImageMagick 7.0.7-22 with no luck and also downgraded to PHP 7.1.