Uncaught ImagickException's on readImageFile

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
ashrafs
Posts: 6
Joined: 2018-01-03T06:53:29-07:00
Authentication code: 1152

Uncaught ImagickException's on readImageFile

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Uncaught ImagickException's on readImageFile

Post 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?
snibgo's IM pages: im.snibgo.com
ashrafs
Posts: 6
Joined: 2018-01-03T06:53:29-07:00
Authentication code: 1152

Re: Uncaught ImagickException's on readImageFile

Post 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
ashrafs
Posts: 6
Joined: 2018-01-03T06:53:29-07:00
Authentication code: 1152

Re: Uncaught ImagickException's on readImageFile

Post by ashrafs »

Anyone?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Uncaught ImagickException's on readImageFile

Post by fmw42 »

try posting to the Bugs forum.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Uncaught ImagickException's on readImageFile

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Uncaught ImagickException's on readImageFile

Post 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.
ashrafs
Posts: 6
Joined: 2018-01-03T06:53:29-07:00
Authentication code: 1152

Re: Uncaught ImagickException's on readImageFile

Post by ashrafs »

No errors with the command line. Thanks for all the responses. Will try and log something with the Imagick team.
ashrafs
Posts: 6
Joined: 2018-01-03T06:53:29-07:00
Authentication code: 1152

Re: Uncaught ImagickException's on readImageFile

Post 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.
Post Reply