PHP exif_read_data Illegal IFD size

stuzzo picture stuzzo · May 20, 2016 · Viewed 17.4k times · Source

I'm working on an application where I fix orientation (if it is present) of jpeg files downloaded from an AWS bucket.

Here you can verify that this image has exif Rotation section.

I download the image with

file_put_contents('/local/path/to/file', file_get_contents('/path/to/url/image'));

And after I try to fix orientation through the Gregwar Image library.

Image::open($path)->fixOrientation()->save($dest, $type, $quality);

I tried with several images and I always receive the message

Warning: exif_read_data('/local/path/to/file'): Illegal IFD size

I thought that was a problem related with how I retrieve the images, but I tried also with cUrl and fopen with the same result.

Someone has some advices?

Answer

Felippe Duarte picture Felippe Duarte · May 20, 2016

You can use a "@" before to ignore warnings: @Image::open($path)->fixOrientation()->save($dest, $type, $quality);

That is a lot of people complaining about this over the internet. Probably some exif data with error. If you operation is working the way you want, just document it and move on.