#39617 [Asn->Fbk]: Erroneously uses the GPS version tag to determine byte order of GPS fields
| From: | jani@php.net | Date: | Sun, 02 Nov 2008 12:38:46 +0000 |
| Subject: | #39617 [Asn->Fbk]: Erroneously uses the GPS version tag to determine byte order of GPS fields | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-130467@lists.php.net to get a copy of this message | ||
ID: 39617
Updated by: jani@php.net
Reported By: me+php at drbeat dot li
-Status: Assigned
+Status: Feedback
Bug Type: EXIF related
Operating System: *
PHP Version: 5.2.0
Assigned To: helly
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2006-11-25 19:26:34] me+php at drbeat dot li
Sorry, wrong link :-(
The picture is at http://www.drbeat.li/test/images/testgps.jpg
Additionally, a correct image is at
http://www.drbeat.li/test/images/testgps2.jpg
------------------------------------------------------------------------
[2006-11-25 15:34:50] helly@php.net
http://www.exif.org/Exif2-2.PDF
A. Tags Relating to GPS
GPSVersionID
Indicates the version of GPSInfoIFD. The version is given as 2.2.0.0.
This tag is mandatory when GPSInfo tag is
present. Note that the GPSVersionID tag is written as a different byte
than the Exif Version tag.
Tag = 0 (0.H)
Type = BYTE
Count = 4
Default = 2.2.0.0
2.2.0.0 = Version 2.2
Other = reserved
======================================
That is your GPS IFD is corrupted. No matter what the byte order is -
the version is always stored in the same order.
To analyze whether t he whole data is corrupted or there is still an
error in ext/exif i would need the image.
------------------------------------------------------------------------
[2006-11-24 16:16:43] me+php at drbeat dot li
BTW, this image was resized in Apple's iPhoto.
------------------------------------------------------------------------
[2006-11-24 13:19:02] me+php at drbeat dot li
Description:
------------
When reading GPS EXIF tags, PHP seems to use the GPS version tag to
determine the byte order of the other GPS tags instead of the byte order
indicator from the EXIF header. An image that shows the incorrect
behavior is at http://www.drbeat.li/test/testgps.jpg .
In this picture, the GPS tag version is stored as the bytes [0, 0, 2,
2] instead of as [2, 2, 0, 0]. exif_read_data() consequently returns
wrong fractions for latitude, longitude and altitude.
Reproduce code:
---------------
if (($exif = @exif_read_data($file, 0, true)) !== false &&
$exif['GPS'])
print_r($exif['GPS']);
Expected result:
----------------
Array
(
[GPSVersion] => ????
[GPSLatitudeRef] => N
[GPSLatitude] => Array
(
[0] => 47/1
[1] => 8/1
[2] => 96/25
)
[GPSLongitudeRef] => E
[GPSLongitude] => Array
(
[0] => 7/1
[1] => 13/1
[2] => 60801/1250
)
[GPSAltitudeRef] => ?
[GPSAltitude] => 436/1
)
Actual result:
--------------
Array
(
[GPSVersion] => ????
[GPSLatitudeRef] => N
[GPSLatitude] => Array
(
[0] => 196608/3276800
[1] => 65536/2004877312
[2] => 57999413/-1526726656
)
[GPSLongitudeRef] => E
[GPSLongitude] => Array
(
[0] => 38666275/3080192
[1] => 65536/524288
[2] => 65536/6291456
)
[GPSAltitudeRef] => ?
[GPSAltitude] => 1638400/458752
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39617&edit=1