Snap Posted August 1, 2020 Share Posted August 1, 2020 (edited) Hello, I have two photos. According to http://metapicz.com (a website that displays exif data for an image) image1.jpg has a GPSAltitudeRef which is "below sea level". For the second image the GPSAltitudeRef is reported as "above sea level". When I extract the GPS data in PHP for the first image I get... $exif1 = exif_read_data('image1.jpg', 0, true); ["GPS"]=> array(17) { ["GPSVersion"]=> string(4) "" ["GPSLatitudeRef"]=> string(1) "N" ["GPSLatitude"]=> array(3) { [0]=> string(4) "37/1" [1]=> string(4) "47/1" [2]=> string(10) "42221/1000" } ["GPSLongitudeRef"]=> string(1) "W" ["GPSLongitude"]=> array(3) { [0]=> string(5) "122/1" [1]=> string(4) "23/1" [2]=> string(10) "46896/1000" } ["GPSAltitudeRef"]=> string(1) "" ["GPSAltitude"]=> string(7) "1408/10" ["GPSTimeStamp"]=> array(3) { [0]=> string(3) "4/1" [1]=> string(4) "43/1" [2]=> string(10) "38000/1000" } ["GPSStatus"]=> string(1) "A" ["GPSMeasureMode"]=> string(1) "3" ["GPSSpeedRef"]=> string(1) "K" ["GPSSpeed"]=> string(4) "8/10" ["GPSTrackRef"]=> string(1) "T" ["GPSTrack"]=> string(9) "25135/100" ["GPSMapDatum"]=> string(6) "WGS-84" ["GPSDateStamp"]=> string(10) "2011:07:15" ["GPSDifferential"]=> int(0) } When I extract the GPS data in PHP for the second image I get... $exif2 = exif_read_data('image2.jpg', 0, true); ["GPS"]=> array(13) { ["GPSVersion"]=> string(4) "" ["GPSLatitudeRef"]=> string(1) "N" ["GPSLatitude"]=> array(3) { [0]=> string(4) "43/1" [1]=> string(4) "53/1" [2]=> string(8) "2950/100" } ["GPSLongitudeRef"]=> string(1) "W" ["GPSLongitude"]=> array(3) { [0]=> string(4) "79/1" [1]=> string(4) "25/1" [2]=> string(8) "3516/100" } ["GPSAltitudeRef"]=> string(1) "" ["GPSAltitude"]=> string(9) "19650/100" ["GPSTimeStamp"]=> array(3) { [0]=> string(4) "19/1" [1]=> string(3) "9/1" [2]=> string(3) "5/1" } ["GPSDOP"]=> string(10) "14134/1000" ["GPSImgDirectionRef"]=> string(1) "M" ["GPSImgDirection"]=> string(5) "354/1" ["GPSProcessingMode"]=> string(13) "ASCIIfused" ["GPSDateStamp"]=> string(10) "2020:06:24" } That is all the GPS data extracted for each image. The GPSAltitudeRef for both is " ", that is it's empty. According to other sources on the net if it had a value then (0 = above sea level) and (1= below sea level), but both are empty. How do I (or metapicz.com) determine from that exif data that image1.jpg is "below sea level" and image2.jpg is "above sea level". Thanks Edited August 1, 2020 by Snap Quote Link to comment Share on other sites More sharing options...
Barand Posted August 1, 2020 Share Posted August 1, 2020 If they were empty, var_dump would show string(0) "" try echo bin2hex($exif1['GPS']['GPSAltitureRef']); Quote Link to comment Share on other sites More sharing options...
Snap Posted August 1, 2020 Author Share Posted August 1, 2020 I've been searching high and low on Google for an explanation, it worked, thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.