php's exif_read_data can't read GPS data on some images

Started by geoffschultz, July 13, 2012, 09:43:33 AM

Previous topic - Next topic

geoffschultz

I have been using GeoSetter (which uses ExifTool as a back-end) to geocode my images.  I then load these images into my web site where a php script uses exif_read_data to get the GPS lat/long.  On some of the images, particularly older images shot with an Olympus E-20, exif_read_data doesn't return any GPS data, but according to multiple programs (PhotoShop, etc), the GPS data is encoded.  I have tried using FAQ #20 to rewrite the metadata, but that hasn't helped.

If I run a test program to see what EXIF metadata exists on a "good" image (which was shot at the same time), I see:

/usr/www/users/gschultz/GeoffSchultz/photos/galleries/2004_Cruising/Guatemala_Antigua/20040215-110738.jpg :
COMPUTED.html: width="1500" height="1171"
COMPUTED.Height: 1171
COMPUTED.Width: 1500
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 1
COMPUTED.ApertureFNumber: f/2.0
COMPUTED.UserComment:
COMPUTED.UserCommentEncoding: ASCII
COMPUTED.Copyright: Copyright 2004 Geoffrey W. Schultz
COMPUTED.Thumbnail.FileType: 2
COMPUTED.Thumbnail.MimeType: image/jpeg
THUMBNAIL.Compression: 6
THUMBNAIL.XResolution: 72/1
THUMBNAIL.YResolution: 72/1
THUMBNAIL.ResolutionUnit: 2
THUMBNAIL.JPEGInterchangeFormat: 980
THUMBNAIL.JPEGInterchangeFormatLength: 5435
GPSLatitude.0: 14/1
GPSLatitude.1: 34/1
GPSLatitude.2: 1756/14633333
GPSLongitude.0: 90/1
GPSLongitude.1: 43/1
GPSLongitude.2: 499979/8333
GPSTimeStamp.0: 16/1
GPSTimeStamp.1: 7/1
GPSTimeStamp.2: 39/1

However, when I run it on a "bad" image, I see:

/usr/www/users/gschultz/GeoffSchultz/photos/galleries/2004_Cruising/Guatemala_Antigua/20040215-111916.jpg :
COMPUTED.html: width="1500" height="1125"
COMPUTED.Height: 1125
COMPUTED.Width: 1500
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 1
COMPUTED.ApertureFNumber: f/2.8
COMPUTED.UserComment:
COMPUTED.UserCommentEncoding: ASCII
COMPUTED.Copyright: Copyright 2004 Geoffrey W. Schultz
SpecialMode.0: 0
SpecialMode.1: 0
SpecialMode.2: 0
UndefinedTag:0x0206.0: -73
UndefinedTag:0x0206.1: -161
UndefinedTag:0x0206.2: -198
UndefinedTag:0x0206.3: 9
UndefinedTag:0x0206.4: 32
[clip - continues for many lines]

Any ideas on how to generate jpg images that exif_read_data can process?

-- Geoff

geoffschultz

I have attached a copy of the "bad" image which was processed via:

exiftool -all= -tagsfromfile @ -all:all -unsafe *.jpg

I've also tried the following with no success:

exiftool -exif:all= -tagsfromfile @ -exif:all -unsafe -thumbnailimage -F *.jpg

-- Geoff

geoffschultz

Finally, here's the php which generated the output:

<?php
$file = '/usr/www/users/gschultz/GeoffSchultz/photos/galleries/2004_Cruising/Guatemala_Antigua/20040215-111916.jpg';
//   $file = '/usr/www/users/gschultz/GeoffSchultz/photos/galleries/2004_Cruising/Guatemala_Antigua/20040215-110738.jpg';
if (file_exists($file))
   echo "$file :<br />\n";
$exif = exif_read_data($file, 'IFD0');

foreach ($exif as $key => $section) {
    foreach ($section as $name => $val) {
        echo "$key.$name: $val<br />\n";
    }
}
?>

geoffschultz


Phil Harvey

Hi Geoff,

I hadn't responded because I don't have any useful suggestions.

Maybe it makes more sense to ask the author of exif_read_data() why it doesn't read some metadata.

I'm assuming that ExifTool reads it OK.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

geoffschultz

OK, thanks.  I wasn't sure if this just got lost or what.  I'll pursue it with exif_read_data.

-- Geoff

geoffschultz

Phil,

I've just completed moving ~7,000 photos over to a new gallery system (piwigo) which is based on php/mySQL.  The vast majority of these images were geotagged using GeoSetter, but in about 1,000 of them, php can't read the GPS location data.  Note that the IPTC data can be read by php.  Programs such as Photoshop have no issues seeing the GPS data.

What's interesting is that the images with problems span many years, but tend to be clumped within albums.  By clumping I mean that all/most of the photos within a given album exhibit the problem, but other albums taken +/- a day are fine.  All were shot with the same camera (within a given year) & processed with the same software (Photoshop, Thumbsplus, GeoSetter/EXIFtool).

I've tried rewriting the metadata using:

exiftool -all= -tagsfromfile @ -all:all -unsafe *.jpg

but when I do that, all of the metadata (EXIF, IPTC) is stripped from the output file.  Due to the sheer volume of files that need to be fixed, I need a bulk solution.

So, my question is:  Is the above command line correct for rebuilding the IPTC/EXIF metadata and/or is there something else that you can suggest that I try?

-- Geoff




Phil Harvey

Hi Geoff,

Quote from: geoffschultz on August 03, 2012, 09:31:56 AM
exiftool -all= -tagsfromfile @ -all:all -unsafe *.jpg

but when I do that, all of the metadata (EXIF, IPTC) is stripped from the output file.

This should not happen.  This command should copy back all writable information.  Something is wrong if it doesn't.

However, even if this command works I don't think it will solve your problem because the output file should be the same as the input file if ExifTool wrote the original metadata.

If you can figure out why php can't read the GPS location from one of these images, then a bulk solution should be easy to implement.  You just need to do some detective work to figure this out.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

geoffschultz

Phil,

The original IPTC metadata (comment, copyright, country, city, state, etc) was written by a program called Thumbsplus that I've used for years. The GPS position data in both of these files was written by GeoSetter/ExifTool.

Looking at 2 files (which in this case happen to have been taken on the same day), here's the differences that I see based upon output from php's exif_read_data:

Good: FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP
Bad:   FILE.SectionsFound: ANY_TAG, IFD0, EXIF, MAKERNOTE

Good: COMPUTED.Thumbnail.FileType: 2
           COMPUTED.Thumbnail.MimeType: image/jpeg
Bad:    <missing>

Good: IFD0.Exif_IFD_Pointer: 170
          IFD0.GPS_IFD_Pointer: 404
Bad:   <missing>

Good: IFD0.Software: Adobe Photoshop 7.0
Bad:   IFD0.Software: 29-1103

Good: <missing>
Bad:   EXIF.MakerNote: OLYMPF.......

The issue here seems to be original, unedited images taken with the Olympus E-20.  It appears that if the file was touched by Photoshop that the metadata is OK.  Other then editing a ton of files, do you have a suggestion?

-- Geoff

Phil Harvey

Hi Geoff,

It would help if you did the comparison of the ExifTool -a -G1 outputs.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

geoffschultz

Bad file:

G:\2004_Sailing\Guatemala_Antigua>exiftool -a -G1 20040215-111916.jpg
[ExifTool]      ExifTool Version Number         : 8.97
[System]        File Name                       : 20040215-111916.jpg
[System]        Directory                       : .
[System]        File Size                       : 3.5 MB
[System]        File Modification Date/Time     : 2012:07:06 18:23:39-04:00
[System]        File Permissions                : rw-rw-rw-
[File]          File Type                       : JPEG
[File]          MIME Type                       : image/jpeg
[File]          Exif Byte Order                 : Big-endian (Motorola, MM)
[File]          Current IPTC Digest             : 13aa5068487cd435c9081b38f4edf4e5
[File]          Image Width                     : 2560
[File]          Image Height                    : 1920
[File]          Encoding Process                : Baseline DCT, Huffman coding
[File]          Bits Per Sample                 : 8
[File]          Color Components                : 3
[File]          Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
[IFD0]          Image Description               : Colorful Cloth!
[IFD0]          Make                            : OLYMPUS OPTICAL CO.,LTD
[IFD0]          Camera Model Name               : E-20,E-20N,E-20P
[IFD0]          Orientation                     : Horizontal (normal)
[IFD0]          X Resolution                    : 144
[IFD0]          Y Resolution                    : 144
[IFD0]          Resolution Unit                 : inches
[IFD0]          Software                        : 29-1103
[IFD0]          Modify Date                     : 2004:02:15 11:19:16
[IFD0]          Y Cb Cr Positioning             : Co-sited
[IFD0]          Copyright                       : Copyright 2004 Geoffrey W. Schultz
[ExifIFD]       Exposure Time                   : 1/100
[ExifIFD]       F Number                        : 2.8
[ExifIFD]       Exposure Program                : Program AE
[ExifIFD]       ISO                             : 80
[ExifIFD]       Exif Version                    : 0210
[ExifIFD]       Date/Time Original              : 2004:02:15 11:19:16
[ExifIFD]       Create Date                     : 2004:02:15 11:19:16
[ExifIFD]       Components Configuration        : Y, Cb, Cr, -
[ExifIFD]       Exposure Compensation           : 0
[ExifIFD]       Max Aperture Value              : 2.0
[ExifIFD]       Metering Mode                   : Multi-segment
[ExifIFD]       Flash                           : No Flash
[ExifIFD]       Focal Length                    : 19.0 mm
[ExifIFD]       User Comment                    :
[ExifIFD]       Flashpix Version                : 0100
[ExifIFD]       Color Space                     : sRGB
[ExifIFD]       Exif Image Width                : 2560
[ExifIFD]       Exif Image Height               : 1920
[ExifIFD]       File Source                     : Digital Camera
[Olympus]       Special Mode                    : Normal, Sequence: 0, Panorama: (none)
[Olympus]       Quality                         : SHQ (Fine)
[Olympus]       Macro                           : Off
[Olympus]       Black And White Mode            : Off
[Olympus]       Digital Zoom                    : 0.0
[Olympus]       Focal Plane Diagonal            : 11.126 mm
[Olympus]       Lens Distortion Params          : -73 -161 -198 9 32 46
[Olympus]       Camera Type                     : E-20,E-20N,E-20P
[Olympus]       Camera ID                       : OLYMPUS DIGITAL CAMERA
[Olympus]       Shutter Speed Value             : 1/106
[Olympus]       ISO Value                       : 50
[Olympus]       Aperture Value                  : 2.9
[Olympus]       Brightness Value                : 5.80859375
[Olympus]       Flash Mode                      : Off
[Olympus]       Flash Device                    : Unknown (0 0)
[Olympus]       Exposure Compensation           : 0
[Olympus]       Sensor Temperature              : 34
[Olympus]       Lens Temperature                : 33
[Olympus]       Light Condition                 : 0
[Olympus]       Focus Range                     : Normal
[Olympus]       Focus Mode                      : Auto
[Olympus]       Manual Focus Distance           : 0 mm
[Olympus]       Zoom Step Count                 : 15
[Olympus]       Focus Step Count                : 297
[Olympus]       Sharpness                       : Normal
[Olympus]       Flash Charge Level              : 0
[Olympus]       Color Matrix                    : 328 -90 18 -30 346 -60 8 -86 334
[Olympus]       Black Level                     : 32 32 32 32
[Olympus]       WB Mode                         : Auto
[Olympus]       Red Balance                     : 1.421875
[Olympus]       Blue Balance                    : 1.4375
[Olympus]       Color Matrix Number             : 0
[Olympus]       Serial Number                   : 201005601
[Olympus]       Flash Exposure Comp             : undef
[Olympus]       Internal Flash Table            : 0
[Olympus]       External Flash G Value          : undef
[Olympus]       External Flash Bounce           : No
[Olympus]       External Flash Zoom             : 0
[Olympus]       External Flash Mode             : 0
[Olympus]       Contrast                        : Normal
[Olympus]       Sharpness Factor                : 352
[Olympus]       Color Control                   : 24 1024 768 1024 8 256
[Olympus]       Valid Bits                      : 10 0
[Olympus]       Coring Filter                   : 2304
[Olympus]       Olympus Image Width             : 2572
[Olympus]       Olympus Image Height            : 1920
[Olympus]       Scene Detect                    : 0
[Olympus]       Compression Ratio               : 2.7
[Olympus]       Preview Image Valid             : Yes
[Olympus]       Preview Image Start             : 3690694
[Olympus]       Preview Image Length            : 162547
[Olympus]       AF Result                       : 0
[Olympus]       CCD Scan Mode                   : Interlaced
[Olympus]       Noise Reduction                 : Off
[Olympus]       Focus Step Infinity             : 277
[Olympus]       Focus Step Near                 : 464
[InteropIFD]    Interoperability Index          : R98 - DCF basic file (sRGB)
[InteropIFD]    Interoperability Version        : 0100
[GPS]           GPS Version ID                  : 2.2.0.0
[GPS]           GPS Latitude Ref                : North
[GPS]           GPS Latitude                    : 14 deg 34' 0.00"
[GPS]           GPS Longitude Ref               : West
[GPS]           GPS Longitude                   : 90 deg 43' 60.00"
[GPS]           GPS Time Stamp                  : 16:19:16
[GPS]           GPS Map Datum                   : WGS-84
[GPS]           GPS Date Stamp                  : 2004:02:15
[IFD1]          Compression                     : JPEG (old-style)
[IFD1]          X Resolution                    : 72
[IFD1]          Y Resolution                    : 72
[IFD1]          Resolution Unit                 : inches
[IFD1]          Thumbnail Offset                : 5088
[IFD1]          Thumbnail Length                : 6674
[IPTC]          Application Record Version      : 4
[IPTC]          City                            : Fronteras
[IPTC]          Country-Primary Location Name   : Guatemala
[IPTC]          Copyright Notice                : Copyright 2004 Geoffrey W. Schultz
[IPTC]          Caption-Abstract                : Colorful Cloth!
[IPTC]          Country-Primary Location Code   : GTM
[XMP-x]         XMP Toolkit                     : Image::ExifTool 8.97
[XMP-iptcCore]  Country Code                    : GTM
[XMP-dc]        Description                     : Colorful Cloth!
[XMP-dc]        Rights                          : Copyright 2004 Geoffrey W. Schultz
[XMP-exif]      Color Space                     : sRGB
[XMP-exif]      Components Configuration        : Y, Cb, Cr, -
[XMP-exif]      Date/Time Digitized             : 2004:02:15 11:19:16-05:00
[XMP-exif]      Date/Time Original              : 2004:02:15 11:19:16-05:00
[XMP-exif]      Exif Version                    : 0210
[XMP-exif]      Exposure Compensation           : 0
[XMP-exif]      Exposure Program                : Program AE
[XMP-exif]      Exposure Time                   : 1/100
[XMP-exif]      F Number                        : 2.8
[XMP-exif]      File Source                     : Digital Camera
[XMP-exif]      Flashpix Version                : 0100
[XMP-exif]      Focal Length                    : 19.0 mm
[XMP-exif]      GPS Latitude                    : 14 deg 34' 0.00" N
[XMP-exif]      GPS Longitude                   : 90 deg 43' 60.00" W
[XMP-exif]      GPS Map Datum                   : WGS-84
[XMP-exif]      GPS Date/Time                   : 2004:02:15 16:19:16Z
[XMP-exif]      GPS Version ID                  : 2.2.0.0
[XMP-exif]      ISO                             : 80
[XMP-exif]      Max Aperture Value              : 2.0
[XMP-exif]      Metering Mode                   : Multi-segment
[XMP-exif]      Exif Image Width                : 2560
[XMP-exif]      Exif Image Height               : 1920
[XMP-exif]      User Comment                    :
[XMP-photoshop] City                            : Fronteras
[XMP-photoshop] Country                         : Guatemala
[XMP-photoshop] Date Created                    : 2004:02:15 11:19:16
[XMP-tiff]      Compression                     : JPEG (old-style)
[XMP-tiff]      Image Description               : OLYMPUS DIGITAL CAMERA
[XMP-tiff]      Make                            : OLYMPUS OPTICAL CO.,LTD
[XMP-tiff]      Camera Model Name               : E-20,E-20N,E-20P
[XMP-tiff]      Orientation                     : Horizontal (normal)
[XMP-tiff]      Resolution Unit                 : inches
[XMP-tiff]      Software                        : 29-1103
[XMP-tiff]      X Resolution                    : 144
[XMP-tiff]      Y Cb Cr Positioning             : Co-sited
[XMP-tiff]      Y Resolution                    : 144
[XMP-xmp]       Create Date                     : 2004:02:15 11:19:16
[XMP-xmp]       Modify Date                     : 2004:02:15 11:19:16-05:00
[Composite]     Aperture                        : 2.8
[Composite]     GPS Date/Time                   : 2004:02:15 16:19:16Z
[Composite]     GPS Latitude                    : 14 deg 34' 0.00" N
[Composite]     GPS Latitude Ref                : North
[Composite]     GPS Longitude                   : 90 deg 43' 60.00" W
[Composite]     GPS Longitude Ref               : West
[Composite]     GPS Position                    : 14 deg 34' 0.00" N, 90 deg 43' 60.00" W
[Composite]     Image Size                      : 2560x1920
[Composite]     Preview Image                   : (Binary data 162547 bytes, use -b option to extract)
[Composite]     Scale Factor To 35 mm Equivalent: 3.9
[Composite]     Shutter Speed                   : 1/100
[Composite]     Thumbnail Image                 : (Binary data 6674 bytes, use -b option to extract)
[Composite]     Circle Of Confusion             : 0.008 mm
[Composite]     Field Of View                   : 27.4 deg
[Composite]     Focal Length                    : 19.0 mm (35 mm equivalent: 73.9 mm)
[Composite]     Hyperfocal Distance             : 16.69 m
[Composite]     Light Value                     : 9.9


Good file:

G:\2004_Sailing\Guatemala_Antigua>exiftool -a -G1 20040215-110738.jpg
[ExifTool]      ExifTool Version Number         : 8.97
[System]        File Name                       : 20040215-110738.jpg
[System]        Directory                       : .
[System]        File Size                       : 1411 kB
[System]        File Modification Date/Time     : 2012:07:28 07:17:56-04:00
[System]        File Permissions                : rw-rw-rw-
[File]          File Type                       : JPEG
[File]          MIME Type                       : image/jpeg
[File]          Exif Byte Order                 : Big-endian (Motorola, MM)
[File]          Current IPTC Digest             : 659a6588c1456389e709f046696d5b48
[File]          Image Width                     : 2244
[File]          Image Height                    : 1752
[File]          Encoding Process                : Baseline DCT, Huffman coding
[File]          Bits Per Sample                 : 8
[File]          Color Components                : 3
[File]          Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
[JFIF]          JFIF Version                    : 1.02
[JFIF]          Resolution Unit                 : inches
[JFIF]          X Resolution                    : 144
[JFIF]          Y Resolution                    : 144
[IFD0]          Image Description               : Inside Cathedral
[IFD0]          Make                            : OLYMPUS OPTICAL CO.,LTD
[IFD0]          Camera Model Name               : E-20,E-20N,E-20P
[IFD0]          Orientation                     : Horizontal (normal)
[IFD0]          X Resolution                    : 144
[IFD0]          Y Resolution                    : 144
[IFD0]          Resolution Unit                 : inches
[IFD0]          Software                        : Adobe Photoshop 7.0
[IFD0]          Modify Date                     : 2004:02:15 11:07:39
[IFD0]          Y Cb Cr Positioning             : Co-sited
[IFD0]          Copyright                       : Copyright 2004 Geoffrey W. Schultz
[ExifIFD]       Exposure Time                   : 1/20
[ExifIFD]       F Number                        : 2.0
[ExifIFD]       Exposure Program                : Program AE
[ExifIFD]       ISO                             : 320
[ExifIFD]       Exif Version                    : 0210
[ExifIFD]       Date/Time Original              : 2004:02:15 11:07:39
[ExifIFD]       Create Date                     : 2004:02:15 11:07:39
[ExifIFD]       Components Configuration        : Y, Cb, Cr, -
[ExifIFD]       Exposure Compensation           : 0
[ExifIFD]       Max Aperture Value              : 2.0
[ExifIFD]       Metering Mode                   : Multi-segment
[ExifIFD]       Flash                           : No Flash
[ExifIFD]       Focal Length                    : 9.0 mm
[ExifIFD]       Flashpix Version                : 0100
[ExifIFD]       Color Space                     : sRGB
[ExifIFD]       Exif Image Width                : 2244
[ExifIFD]       Exif Image Height               : 1752
[ExifIFD]       File Source                     : Digital Camera
[InteropIFD]    Interoperability Index          : R98 - DCF basic file (sRGB)
[InteropIFD]    Interoperability Version        : 0100
[GPS]           GPS Version ID                  : 2.2.0.0
[GPS]           GPS Latitude Ref                : North
[GPS]           GPS Latitude                    : 14 deg 34' 0.00"
[GPS]           GPS Longitude Ref               : West
[GPS]           GPS Longitude                   : 90 deg 44' 0.00"
[GPS]           GPS Time Stamp                  : 16:07:39
[GPS]           GPS Map Datum                   : WGS-84
[GPS]           GPS Date Stamp                  : 2004:02:15
[IFD1]          Compression                     : JPEG (old-style)
[IFD1]          X Resolution                    : 72
[IFD1]          Y Resolution                    : 72
[IFD1]          Resolution Unit                 : inches
[IFD1]          Thumbnail Offset                : 1128
[IFD1]          Thumbnail Length                : 5435
[XMP-x]         XMP Toolkit                     : XMP Core 5.1.2
[XMP-iptcCore]  Country Code                    : GTM
[XMP-photoshop] City                            : Fronteras
[XMP-photoshop] Country                         : Guatemala
[XMP-photoshop] Date Created                    : 2004:02:15 11:07:39-05:00
[XMP-xmp]       Modify Date                     : 2004:02:15 11:07:39-05:00
[XMP-xmp]       Create Date                     : 2004:02:15 11:07:39-05:00
[XMP-xmp]       Creator Tool                    : Adobe Photoshop 7.0
[XMP-xmpMM]     Document ID                     : adobe:docid:photoshop:f74b7af3-648e-11d8-bf5c-d454f730a591
[XMP-xmpMM]     Instance ID                     : uuid:f74b7af5-648e-11d8-bf5c-d454f730a591
[XMP-dc]        Description                     : Inside Cathedral
[XMP-dc]        Rights                          : Copyright 2004 Geoffrey W. Schultz
[IPTC]          Coded Character Set             : UTF8
[IPTC]          Application Record Version      : 4
[IPTC]          Date Created                    : 2004:02:15
[IPTC]          Time Created                    : 11:07:39-05:00
[IPTC]          City                            : Fronteras
[IPTC]          Country-Primary Location Code   : GTM
[IPTC]          Country-Primary Location Name   : Guatemala
[IPTC]          Copyright Notice                : Copyright 2004 Geoffrey W. Schultz
[IPTC]          Caption-Abstract                : Inside Cathedral
[Photoshop]     Copyright Flag                  : False
[Photoshop]     IPTC Digest                     : 659a6588c1456389e709f046696d5b48
[ICC-header]    Profile CMM Type                : Lino
[ICC-header]    Profile Version                 : 2.1.0
[ICC-header]    Profile Class                   : Display Device Profile
[ICC-header]    Color Space Data                : RGB
[ICC-header]    Profile Connection Space        : XYZ
[ICC-header]    Profile Date Time               : 1998:02:09 06:49:00
[ICC-header]    Profile File Signature          : acsp
[ICC-header]    Primary Platform                : Microsoft Corporation
[ICC-header]    CMM Flags                       : Not Embedded, Independent
[ICC-header]    Device Manufacturer             : IEC
[ICC-header]    Device Model                    : sRGB
[ICC-header]    Device Attributes               : Reflective, Glossy, Positive, Color
[ICC-header]    Rendering Intent                : Perceptual
[ICC-header]    Connection Space Illuminant     : 0.9642 1 0.82491
[ICC-header]    Profile Creator                 : HP
[ICC-header]    Profile ID                      : 0
[ICC_Profile]   Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
[ICC_Profile]   Profile Description             : sRGB IEC61966-2.1
[ICC_Profile]   Media White Point               : 0.95045 1 1.08905
[ICC_Profile]   Media Black Point               : 0 0 0
[ICC_Profile]   Red Matrix Column               : 0.43607 0.22249 0.01392
[ICC_Profile]   Green Matrix Column             : 0.38515 0.71687 0.09708
[ICC_Profile]   Blue Matrix Column              : 0.14307 0.06061 0.7141
[ICC_Profile]   Device Mfg Desc                 : IEC http://www.iec.ch
[ICC_Profile]   Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
[ICC_Profile]   Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
[ICC_Profile]   Luminance                       : 76.03647 80 87.12462
[ICC_Profile]   Technology                      : Cathode Ray Tube Display
[ICC_Profile]   Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
[ICC_Profile]   Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
[ICC_Profile]   Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
[ICC-view]      Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
[ICC-view]      Viewing Cond Surround           : 3.92889 4.07439 3.36179
[ICC-view]      Viewing Cond Illuminant Type    : D50
[ICC-meas]      Measurement Observer            : CIE 1931
[ICC-meas]      Measurement Backing             : 0 0 0
[ICC-meas]      Measurement Geometry            : Unknown (0)
[ICC-meas]      Measurement Flare               : 0.999%
[ICC-meas]      Measurement Illuminant          : D65
[Adobe]         DCT Encode Version              : 100
[Adobe]         APP14 Flags 0                   : [14]
[Adobe]         APP14 Flags 1                   : (none)
[Adobe]         Color Transform                 : YCbCr
[Composite]     Aperture                        : 2.0
[Composite]     Date/Time Created               : 2004:02:15 11:07:39-05:00
[Composite]     GPS Date/Time                   : 2004:02:15 16:07:39Z
[Composite]     GPS Latitude                    : 14 deg 34' 0.00" N
[Composite]     GPS Longitude                   : 90 deg 44' 0.00" W
[Composite]     GPS Position                    : 14 deg 34' 0.00" N, 90 deg 44' 0.00" W
[Composite]     Image Size                      : 2244x1752
[Composite]     Shutter Speed                   : 1/20
[Composite]     Thumbnail Image                 : (Binary data 5435 bytes, use -b option to extract)
[Composite]     Focal Length                    : 9.0 mm
[Composite]     Light Value                     : 4.6


Phil Harvey

There are a number of differences between these files:

1) The bad file doesn't contain a JFIF segment

2) The bad file contains makernote information

3) The bad file contains IPTC

4) The bad file contains GPS in the XMP too

5) The good file has an ICC_Profile

Plus other differences.

I suggest using exiftool to incrementally change the information in the good file to match the bad file until you find the exact difference that breaks it for your PHP reader.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

geoffschultz

I just ran a test where I had PhotoShop re-write the file after making essentially no changes and php can now read the GPS metatdata.

Quote from: Phil Harvey on August 03, 2012, 11:53:51 AMI suggest using exiftool to incrementally change the information in the good file to match the bad file until you find the exact difference that breaks it for your PHP reader.

Sorry for being a bit dense with regards to your suggestion, but how does one do the above?  Are you suggesting making changes to each section using exiftool until it works?

-- Geoff

Phil Harvey

Quote from: geoffschultz on August 03, 2012, 12:09:12 PM
Sorry for being a bit dense with regards to your suggestion, but how does one do the above?  Are you suggesting making changes to each section using exiftool until it works?

Yes.  Start by copying the good file to test.jpg, then do this:

1) Remove the JFIF section

exiftool -jfif:all= test.jpg

2) copy the maker notes

exiftool -tagsfromfile bad.jpg -makernotes test.jpg

3) copy the IPTC

exiftool -tagsfromfile bad.jpg -iptc:all test.jpg

4) copy missing XMP tags

exiftool -tagsfromfile bad.jpg -xmp:all test.jpg

5) delete the ICC_Profile

exiftool -icc_profile= test.jpg

etc...  until the test file is the same as bad.jpg.

And try reading with PHP after each step.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

geoffschultz

Quote from: Phil Harvey on August 03, 2012, 12:14:35 PM
1) Remove the JFIF section

exiftool -jfif:all= test.jpg

When I execute the above command, I get the following message:

0 image files updated
1 image files unchanged

When I examine the file using exiftool -a -G1, it appears the same as bad.jpg

-- Geoff