reedstonefood
reedstonefood

Reputation: 131

PHP - corrupt exif data error with Fulifilm photos

PHP version 5.3.10

In short, I can't get all the EXIF data out of my photos - it says they are corrupt - but another PHP can get all the data out, so I'm sure it's possible, but I don't know how. Now for the more detailed version...

I have a script just to see all the EXIF data for a given JPG file from my camera. It looks like this...

$exif_data = exif_read_data ('TEST.JPG', 0, TRUE); 
foreach ($exif_data as $key => $section) {
    foreach ($section as $name => $val) {
        echo "$key.$name: $val<br />\n";
    }
}

This worked fine for my last camera. However when I run it against any JPG’s from my new FujiFilm camera, I get this error message for the first line in the above list..

Warning: exif_thumbnail(TEST.JPG) [exif_read_data]: corrupt EXIF header: maximum directory nesting level reached in (script name) on line (relevant line)

Then it outputs an incomplete list of the EXIF data.

I would guess the first response to this is "well your file is corrupt" but if I upload it to http://exifdata.com/index.php then it lists all the EXIF data (including the GPS data which is what I'm really interested in). That website apparently runs on PHP too, so I'd suggest that it is indeed possible to get the GPS data out of there using PHP.

I have tried googling the error message but all I get is some old 2005 or 2007 PHP bug, and a similar stackoverflow thread that no-one answered - Issues extracting exif data for exif 2.3 using PHP Version 5.2.9.

So... any ideas?

Upvotes: 2

Views: 1692

Answers (1)

Ian Beckett
Ian Beckett

Reputation: 56

I also have a Fujifilm camera with the same problem, but I think I've found the solution, I've raised a PHP bug report here: https://bugs.php.net/bug.php?id=66443

If you can compile your own PHP from source (or persuade your webhost to do so for you) it's an easy fix.

Upvotes: 2

Related Questions