Skip to content

Commit 847dcf4

Browse files
author
Marek Szymczuk
committed
Fixed line length
1 parent 040e0eb commit 847dcf4

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/PHPExif/Mapper/Exiftool.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,13 @@ public function mapRawData(array $data)
163163

164164
// add GPS coordinates, if available
165165
if (count($gpsData) === 2 && $gpsData['lat'] !== false && $gpsData['lon'] !== false) {
166+
$latitudeRef = isset($data['GPSLatitudeRef'][0]) ? $data['GPSLatitudeRef'][0] : null;
167+
$longitudeRef = isset($data['GPSLongitudeRef'][0]) ? $data['GPSLongitudeRef'][0] : null;
168+
166169
$gpsLocation = sprintf(
167170
'%s,%s',
168-
(isset($data['GPSLatitudeRef'][0]) && strtoupper($data['GPSLatitudeRef'][0]) === 'S' ? -1 : 1) * $gpsData['lat'],
169-
(isset($data['GPSLongitudeRef'][0]) && strtoupper($data['GPSLongitudeRef'][0]) === 'W' ? -1 : 1) * $gpsData['lon']
171+
(strtoupper($latitudeRef) === 'S' ? -1 : 1) * $gpsData['lat'],
172+
(strtoupper($longitudeRef) === 'W' ? -1 : 1) * $gpsData['lon']
170173
);
171174

172175
$mappedData[Exif::GPS] = $gpsLocation;

lib/PHPExif/Mapper/Native.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,13 @@ public function mapRawData(array $data)
181181

182182
// add GPS coordinates, if available
183183
if (count($gpsData) === 2) {
184+
$latitudeRef = isset($data['GPSLatitudeRef'][0]) ? $data['GPSLatitudeRef'][0] : null;
185+
$longitudeRef = isset($data['GPSLongitudeRef'][0]) ? $data['GPSLongitudeRef'][0] : null;
186+
184187
$gpsLocation = sprintf(
185188
'%s,%s',
186-
(isset($data['GPSLatitudeRef'][0]) && strtoupper($data['GPSLatitudeRef'][0]) === 'S' ? -1 : 1) * $gpsData['lat'],
187-
(isset($data['GPSLongitudeRef'][0]) && strtoupper($data['GPSLongitudeRef'][0]) === 'W' ? -1 : 1) * $gpsData['lon']
189+
(strtoupper($latitudeRef) === 'S' ? -1 : 1) * $gpsData['lat'],
190+
(strtoupper($longitudeRef) === 'W' ? -1 : 1) * $gpsData['lon']
188191
);
189192

190193
$mappedData[Exif::GPS] = $gpsLocation;

0 commit comments

Comments
 (0)