I am trying to read the GPS data from an image with the following php script.
Code:
<?php
$filename="IMG_0743.JPG";
// ================== Example of Exif read of GPS Data ==================
$exif = exif_read_data($filename, 'EXIF');
print_r($exif); exit(); <=== To display result
$latitude = gps($exif["GPS.GPSLatitude"], $exif['GPS.GPSLatitudeRef']);
$longitude = gps($exif["GPS"]["GPSLongitude"], $exif["GPS"]['GPSLongitudeRef']);
echo "\nLatitude ".$latitude."\n";
echo "Longitude ".$longitude."\n";
echo "\n ======================================== \n";
echo " ======================================== \n\n";
?>
The result Is:
Array
(
[FileName] => IMG_0743.JPG
[FileDateTime] => 1439766899
[FileSize] => 1175003
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, EXIF
[COMPUTED] => Array
(
[html] => width="2592" height="1936"
[Height] => 1936
[Width] => 2592
[IsColor] => 1
[ByteOrderMotorola] => 1
[ApertureFNumber] => f/2.4
)
[Make] => Apple
[Model] => iPad mini 2
[Orientation] => 1
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[Software] => 8.1
[DateTime] => 2015:08:16 16:14:59
[YCbCrPositioning] => 1
[ExposureTime] => 1/440
[FNumber] => 12/5
[ExposureProgram] => 2
[ISOSpeedRatings] => 32
[ExifVersion] => 0221
[DateTimeOriginal] => 2015:08:16 16:14:59
[DateTimeDigitized] => 2015:08:16 16:14:59
[ComponentsConfiguration] =>
[ShutterSpeedValue] => 6682/761
[ApertureValue] => 4845/1918
[BrightnessValue] => 9577/1196
[ExposureBiasValue] => 0/1
[MeteringMode] => 5
[Flash] => 32
[FocalLength] => 33/10
)
I get the following when the above is run without the exit().
PHP Notice: Undefined index: GPS.GPSLatitude in /home/rick/Pictures/exifPlay/getExif-GPS.php on line 11
PHP Notice: Undefined index: GPS.GPSLatitudeRef in /home/rick/Pictures/exifPlay/getExif-GPS.php on line 11
PHP Notice: Undefined offset: 1 in /home/rick/Pictures/exifPlay/getExif-GPS.php on line 22
PHP Notice: Undefined offset: 2 in /home/rick/Pictures/exifPlay/getExif-GPS.php on line 22
PHP Notice: Undefined index: GPS in /home/rick/Pictures/exifPlay/getExif-GPS.php on line 12
PHP Notice: Undefined index: GPS in /home/rick/Pictures/exifPlay/getExif-GPS.php on line 12
PHP Notice: Undefined offset: 1 in /home/rick/Pictures/exifPlay/getExif-GPS.php on line 22
PHP Notice: Undefined offset: 2 in /home/rick/Pictures/exifPlay/getExif-GPS.php on line 22
Latitude 0
Longitude 0
When I run pyExifToolGUI on this file I get this: See attached file.
How can I get PHP to show the GPS tags??
Thanks, R