[php-src] Issue #9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index

From: Date: Mon, 22 Aug 2022 12:04:17 +0000
Subject: [php-src] Issue #9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242279@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9397 Author: Ben29980 Hello community, I read that on older php versions exif read function was not working properly on certain images. I should have been patched with new php versions... But not fully... On recent DJI images, I have a persistent uncapacity to correctly "read exif data" from image Image example: ![DJI_20220813101819_0001_W](https://user-images.githubusercontent.com/71694955/185741080-02cda5ea-b55b-41b2-ad30-ab14eba0c515.JPG) here an example of errors I have: ![php_exif_error](https://user-images.githubusercontent.com/71694955/185741159-dbbcbcd7-4f1a-45ac-ae08-076882123f43.PNG) Please note that with other images, it works like a charm. And not problem for me to extract data. Here is my code: `//get the EXIF $exif = exif_read_data($file, 'IFD0'); echo $exif===false ? "Aucun en-tête de donnés n'a été trouvé.<br />\n" : "L'image contient des en-têtes<br />\n"; $exif = exif_read_data($file); //get the Hemisphere multiplier $LatM = 1; $LongM = 1; if($exif["GPSLatitudeRef"] == 'S') { $LatM = -1; } if($exif["GPSLongitudeRef"] == 'W') { $LongM = -1; } $alt = explode('/', $exif["GPSAltitude"]); $altitude = (isset($alt[1])) ? ($alt[0] / $alt[1]) : $alt[0]; //get the GPS data $gps['LatDegree']=$exif["GPSLatitude"][0]; $gps['LatMinute']=$exif["GPSLatitude"][1]; $gps['LatgSeconds']=$exif["GPSLatitude"][2]; $gps['LongDegree']=$exif["GPSLongitude"][0]; $gps['LongMinute']=$exif["GPSLongitude"][1]; $gps['LongSeconds']=$exif["GPSLongitude"][2];`

« previous php.bugs (#242279) next »