JoStockton
Forum Replies Created
-
Using date and time formats set in wordpress is better. Replace
$list_coord_gps.="#-".date_format($date,'d/m/Y H:i:s');
with
$date=date_i18n( get_option('date_format')." ".get_option('time_format'), date_timestamp_get($date)); $list_coord_gps.="#-".$date;
@oddcopter replace
$date=date('d/m/Y H:i:s',$unxTimestamp);
with
$date=date_i18n( get_option('date_format')." ".get_option('time_format'), $unxTimestamp);
@oddcopter Try to Replace
$date=date_create_from_format('Y:m:d H:i:s', $img['date']); $list_coord_gps.="#-".date_format($date,'d/m/Y H:i:s');
with
$informat = '%Y:%m:%d %H:%M:%S'; $ftime = strptime($img['date'],$informat); $unxTimestamp = mktime( $ftime['tm_hour'], $ftime['tm_min'], $ftime['tm_sec'], 1, $ftime['tm_yday'] + 1, $ftime['tm_year'] + 1900 ); $date=date('d/m/Y H:i:s',$unxTimestamp); $list_coord_gps.="#-".$date;
Edit : I’m french this is why I format the date d/m/Y. Change it as you want.
Edit2 : this portion of code should work with php 5.1 or greater. All methods are PHP4/PHP5, except strptime PHP 5.1.I figured out the problem with my phone (Galaxy S2 with Cyanogenmod 9), the location was already computed, and stored in $exif[“GPSLatitude”][0] and $exif[“GPSLongitude”][0]. The other entries $exif[“GPSLatitude”][1] etc. are empty.
I made this patch : https://pastebin.com/Ut6efk8k and my code works with photos from my phone.
But this is ugly, as it won’t work if $exif[“GPSLongitude”][1] (or the others) equals 0 for legit reason. This is unlikely, but we never know.
I did nothing nor use specific settings, I just took shoots with my camera with GPS enabled. It’s a Sony HX9V.
After reading your post, I tried with my phone, and indeed that doesn’t work. Seems there is no standard for storing location in pictures. I’ll try to make this work with my phone, maybe this will give us clues.
This is not a problem, take your time with your relocation ??