Populating Geocode information from a file's Exif metadata

Re: [sidcam] Populating Geocode information from a file's Exif metadata

By Toledoh - August 7, 2012

I was looking at this the other day. I haven't progressed very far as yet, but it does look to be fairly simple.

Use the following to get a list of variables that are available to be read;
<?php
$image = "image.jpg";
$exif = exif_read_data($image, 0, true);
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
if($key == "IFD0"){
echo "$key.$name: $val\n";
}
}
}
?>


And once you have identified the variable names that you wish to use, use something like;
<?php
$image = "image.jpg";
$exif = exif_read_data($image, 0, true);
echo "Latitude: " . $exif['IFD0']['Latitude'] . "\n";
?>


I've not tested this yet, but should be close? Let me know how you go!
Cheers,

Tim (toledoh.com.au)