somewhere along the line the output of exif_read_data() changed and it no longer provides populated sections. Adjust for the new format and allow for the old because I cannot find documentation of this change anywhere. This affects photo rotation and the photo map feature.

This commit is contained in:
zotlabs 2018-03-13 22:47:11 -07:00
parent 09a841f3be
commit 128d1f7aa8
2 changed files with 13 additions and 6 deletions

View File

@ -289,7 +289,7 @@ abstract class photo_driver {
return false; return false;
} }
$ort = $exif['IFD0']['Orientation']; $ort = ((array_key_exists('IFD0',$exif)) ? $exif['IFD0']['Orientation'] : $exif['Orientation']);
if(! $ort) { if(! $ort) {
return false; return false;

View File

@ -333,10 +333,17 @@ function photo_upload($channel, $observer, $args) {
$lat = $lon = null; $lat = $lon = null;
if($exif && $exif['GPS']) { if($exif && feature_enabled($channel_id,'photo_location')) {
if(feature_enabled($channel_id,'photo_location')) { $gps = null;
$lat = getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']); if(array_key_exists('GPS',$exif)) {
$lon = getGps($exif['GPS']['GPSLongitude'], $exif['GPS']['GPSLongitudeRef']); $gps = $exif['GPS'];
}
elseif(array_key_exists('GPSLatitude',$exif)) {
$gps = $exif;
}
if($gps) {
$lat = getGps($gps['GPSLatitude'], $gps['GPSLatitudeRef']);
$lon = getGps($gps['GPSLongitude'], $gps['GPSLongitudeRef']);
} }
} }