Skip to content

Commit

Permalink
Fix issues of GPS metadata handling
Browse files Browse the repository at this point in the history
Signed-off-by: Clint Johnson <[email protected]>

GPSAltitudeRef below sea level

Fix GPSAltitudeRef below sea level.

Signed-off-by: Clint Johnson <[email protected]>
  • Loading branch information
nmbgeek committed Sep 24, 2024
1 parent 3d6ce9a commit b674472
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Listener/ExifMetadataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public function handle(Event $event): void {
$gps['longitude'] = $this->gpsDegreesToDecimal($rawExifData['GPS']['GPSLongitude'], $rawExifData['GPS']['GPSLongitudeRef']);
}

if (array_key_exists('GPSAltitude', $rawExifData['GPS']) && array_key_exists('GPSAltitudeRef', $rawExifData['GPS'])) {
$gps['altitude'] = ($rawExifData['GPS']['GPSAltitudeRef'] === "\u{0000}" ? 1 : -1) * $this->parseGPSData($rawExifData['GPS']['GPSAltitude']);
if (array_key_exists('GPSAltitude', $rawExifData['GPS']) && array_key_exists('GPSAltitudeRef', $rawExifData['GPS']) && is_string($rawExifData['GPS']['GPSAltitude'])) {
$gps['altitude'] = ($rawExifData['GPS']['GPSAltitudeRef'] === '1' || $rawExifData['GPS']['GPSAltitudeRef'] === "\u{0001}" ? -1 : 1) * $this->parseGPSData($rawExifData['GPS']['GPSAltitude']);
}

if (!empty($gps)) {
Expand Down

0 comments on commit b674472

Please sign in to comment.