I have problem with some of my photos when i want to read EXIF data.
My code below:
$exif_date = exif_read_data($file_path, 'IFD0');
With some images i get warrning: Message: exif_read_data(001.jpg) [function.exif-read-data]: Incorrect APP1 Exif Identifier Code
My question is: how can I awoid this warrning, can I check somehow if app1 is correct before exif_read? Thanks for help.
For the quick answer, take a look at the last rows of this post.
I think some code is still missing. I came exactly across the same problem and after searching I found multiple websites related to this problem:
http://drupal.org/node/556970 a bug report with 2 solutions:
@
in front of exif_read_data
$imageinfo['APP1']
if it contains ExifAfter reading dcro's answer here, I found out that the second parameter of getimagesize()
returns such an $imageinfo
array. Now I tested one of my images with the following code:
<?php
getimagesize("test.jpg", $info);
var_dump($info);
?>
This returned the following:
array(1) {
["APP1"]=>
string(434) "http://ns.adobe.com/xap/1.0/<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Exempi + XMP Core 4.1.1">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:type>Image</dc:type>
<dc:format>image/jpeg</dc:format>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>"
}
This btw. doesn't look like Exif. This looks more like XMP, but the funny part is that for example the exiftool finds some exif data (orientation for example). In the XMP specification I found that it is possible to have XMP and Exif data side by side in one file (page 18). Further search revealed that there are script like this one to extract Exif from XMP.
Anyway, since
I will still use the @exif-read-data($file_path)
solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With