Reputation: 193
I'm trying to extract the exif information from an image with this foreach-loop and printing out for example the camera maker:
function readoutexifinfo($cur_image){
$exif = exif_read_data($cur_image, 0, true);
foreach ($exif as $key => $section) { // $key IFD0; COMPUTED, ANY TAG, EXIF etc.
foreach ($section as $name => $val) {
if($key == "ANY_TAG"){
echo $key.':'.$name.': '.$val."<br/>";
}
if($key == "FILE"){
echo $key.':'.$name.': '.$val."<br/>";
}
if($key == "COMPUTED"){
echo $key.':'.$name.': '.$val."<br/>";
}
if($key == "IFD0"){
echo $key.':'.$name.': '.$val."<br/>";
}
if($key == "EXIF"){
echo $key.':'.$name.': '.$val."<br/>";
}
if($key == "INTEROP"){
echo $key.':'.$name.': '.$val."<br/>";
}
}
}
echo "Camera maker: ".$exif['IFD0']['make'];
}
The variabel $cur_image is predefined with an .jpg image. When i run this:
readoutexifinfo($cur_image);
I get this error message:
Notice: Undefined index: make
So my question is how can I get elements from ex. IFDO ['camera']['make'] ?
Upvotes: 1
Views: 203
Reputation: 99687
If that line is giving you that error, then the element $exif['IFD0']['make']
simply does not exist. Did you mean $exif['IFD0']['camera']['make']
?
Upvotes: 1