Cannot read GPS Coordinates after "Take Photo" option

A

Anonymous

Guest
Hi!
I created app to read Geo Location using exif_read_data function.

$info = exif_read_data($file);
if (isset($info['GPSLatitude']) && isset($info['GPSLongitude']) &&
isset($info['GPSLatitudeRef']) && isset($info['GPSLongitudeRef']) &&
in_array($info['GPSLatitudeRef'], array('E','W','N','S')) && in_array($info['GPSLongitudeRef'], array('E','W','N','S'))) {

$GPSLatitudeRef = strtolower(trim($info['GPSLatitudeRef']));
...................................... and so on
}

It works for all pictures ALREADY TAKEN (from "Photo Library"). If I want to use an option "Take Photo",
isset($info['GPSLatitude']) IS FALSE.

Is it something about security?

Thanks,
Alex
 
I'm assuming that your "Take Photo" option is using an inbuilt camera in the device you are running the script from, if this is the case then:

The camera software may not provide a gps location
The camera software may not provide exif data
The camera software may not provide exif data that exif_read_data can read
When loading the photo onto your computer, it may wipe away the exif data, especially if processing the image through PHP first.

Exif data is an optional thing and not all cameras provide the information or may have their own way of providing it, so exif_read_data can have serious limitations.
 
Thank you hyper!
If the camera software is not providing a gps location, why I was able to get coordinates after:

I saved the image on the camera;
I uploaded this image to my program?

I'm using iPhone 6.
 
Was your "ALREADY TAKEN (from "Photo Library")." taken using the same phone?
 
Yes! Same iPhone.
And I used the same iPhone to upload the pic.

Scenario 1:
I took a pic
Opened app to upload a file
Selected (from "Photo Library") - got coordinates!

Scenario 2:
Opened app to upload a file
Selected "Take Photo" - no coordinates! :-(
 
So the same script (shown in first post) is used for both options, using the same phone? it is just the location from where the photo is uploaded from ("Photo Library", "Take Photo") that is different?

Does the "Take Photo" option literally take the photo then upload it?

Where is the script executed?
 
1. Yes, the same script, and only the uploaded option is different.
2. Yes. I noticed after "Take Photo" option iPhone didn't save the picture in the library. Uploading happened, but no coordinates info in the header.
My only guess is the system adds Geolocation information into the header during saving to the "Photo Library".
3. On the server: LINUX, PHP 5

Thank you Hyper!
 
My only guess is the system adds Geolocation information into the header during saving to the "Photo Library".

I agree, it's a reminder when writing your own scripts to keep an open mind as to how people will actually use it :?
 
Back
Top