PHP exif_read_data Illegal IFD size PHP exif_read_data Illegal IFD size php php

PHP exif_read_data Illegal IFD size


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.


PHP 5.6.2x is having a bug with its EXIF capability (see bug #72914 as well as #72819 for further info). Attempting to read EXIF data will result in one of the described errors (Illegal IFD size, IFD bad data, other).

At present (2016-11-21) there is no fix available for the 5.6 branch. There is some testing going on in branch 7.

Implement a local fix by testing for the function throwing IFD errors, and when confirmed assume EXIF to be unavailable for the duration of the script.

(You can patch that into the loader if you wish, and 'overload' the functions to return default false/0/null instead to indicate breakage)


I've also encountered this problem using exif_get_data. I can handle images on my localhost (PHP v5.4.15) but on my web host (PHP v5.6.22) the error 'illegal IFD size' even though I'd tried the "@" ignore warning method.I found that on the web host (whether because of different version or installation), exif_get_data was actually throwing an exception rather than issuing a warning. I'm using the exif data to reorientate the picture if it's been rotated, so if the exif data is faulty or not present I just ignore it and do nothing, here's the code snippet:

     try {        $exif = exif_read_data($filePath);     }     catch (Exception $exp) {        $exif = false;     }     if ($exif){        ...     }