Skip to content

Commit 0ca219c

Browse files
authored
Merge pull request #65 from wasinger/bugfix_extract_gps
Bugfix for fatal error in extractGPSCoordinate
2 parents ce410fe + 5e3b3ac commit 0ca219c

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lib/PHPExif/Mapper/Native.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,14 @@ protected function isFieldKnown(&$field)
249249
/**
250250
* Extract GPS coordinates from components array
251251
*
252-
* @param array $components
252+
* @param array|string $components
253253
* @return float
254254
*/
255-
protected function extractGPSCoordinate(array $components)
255+
protected function extractGPSCoordinate($components)
256256
{
257+
if (!is_array($components)) {
258+
$components = array($components);
259+
}
257260
$components = array_map(array($this, 'normalizeComponent'), $components);
258261

259262
if (count($components) > 2) {

tests/PHPExif/ExifTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,8 @@ public function testAdapterConsistency()
611611
$methods = $reflClass->getMethods(ReflectionMethod::IS_PUBLIC);
612612
$testfiles = array(
613613
PHPEXIF_TEST_ROOT . '/files/morning_glory_pool_500.jpg',
614-
PHPEXIF_TEST_ROOT . '/files/dsc_5794.jpg'
614+
PHPEXIF_TEST_ROOT . '/files/dsc_5794.jpg',
615+
PHPEXIF_TEST_ROOT . '/files/dsc_0003.jpg'
615616
);
616617

617618
$adapter_exiftool = new \PHPExif\Adapter\Exiftool();

tests/files/dsc_0003.jpg

1.7 MB
Loading

0 commit comments

Comments
 (0)