Cannot get IPTC:Caption-Abstract to appear in -php array output

Started by gregc, March 30, 2021, 08:42:38 PM

Previous topic - Next topic

gregc

Hello,  I am working with a batch of images that early this century, for some unknown reason, had their original IPTC data "Moved" into the IPTC field Caption-Abstract.

$ exiftool -a -G1 -s /mnt/usb1/scc/L/HiRes/Legacy/A00464.JPG


...
[Adobe]         ColorTransform                  : YCbCr
[IPTC2]         ApplicationRecordVersion        : 2
[IPTC2]         DateCreated                     : 1999:11:19
[IPTC2]         Caption-Abstract                : Camera:   EOS D2000C.Serial #: C520C-02874.Width:    1152.Height:   1728.Date:  11/19/99.Time:   13:44:51.\
DCS5XX Image.FW Ver:   2.0.3.TIFF Image.Look:   Product.Antialiasing Filter:  Removed.Tagged.Counter:    [1115].ISO Speed:  400.Aperture:  f7.1.Shutter:  1/\
400.Max Aperture:  f2.8.Min Aperture:  f32.Exposure Mode:  Shutter priority AE (Tv).Compensation:  +1.0.Flash Compensation:  +0.0.Meter Mode:  Evaluative.Fl\
ash Mode:  No flash.Drive Mode:  Single.Focus Mode:  Manual.Focus Point:  o----.Focal Length (mm):  100.White balance: Auto (Daylight).Time: 13:44:51.003.
[AFCP]          ThumbnailImage                  : (Binary data 4081 bytes, use -b option to extract)
[AFCP]          PreviewImage                    : (Binary data 40774 bytes, use -b option to extract)
[Composite]     ImageSize                       : 1092x1572
[Composite]     Megapixels                      : 1.7
...

There are 3x IPTC2 fields listed in this output.  I can get the other two IPTC2 fields to appear in a php array, but not Caption-Abstract:


<?php
eval('$array=' . `exiftool -php /mnt/usb1/scc/L/HiRes/Legacy/A00464.JPG`);
print_r($array);
?>


Array
(
    [0] => Array
        (
            [SourceFile] => /mnt/usb1/scc/L/HiRes/Legacy/A00464.JPG
            [ExifToolVersion] => 10.1
            [FileName] => A00464.JPG
            [Directory] => /mnt/usb1/scc/L/HiRes/Legacy
            [FileSize] => 464 kB
            [FileModifyDate] => 2017:07:29 06:24:06+10:00
            [FileAccessDate] => 2021:03:29 10:10:15+11:00
            [FileInodeChangeDate] => 2019:02:07 22:57:40+11:00
            [FilePermissions] => rwxrwxrwx
            [FileType] => JPEG
            [FileTypeExtension] => jpg
            [MIMEType] => image/jpeg
            [JFIFVersion] => 1.02
            [ResolutionUnit] => inches
            [XResolution] => 200
            [YResolution] => 200
            [Comment] => File written by Adobe Photoshop\250 4.0
            [DCTEncodeVersion] => 100
            [APP14Flags0] => [14]
            [APP14Flags1] => (none)
            [ColorTransform] => YCbCr
            [ImageWidth] => 1092
            [ImageHeight] => 1572
            [EncodingProcess] => Baseline DCT, Huffman coding
            [BitsPerSample] => 8
            [ColorComponents] => 3
            [YCbCrSubSampling] => YCbCr4:4:4 (1 1)
-->      [ApplicationRecordVersion] => 2
-->      [DateCreated] => 1999:11:19
Time: 13:44:51.003
            [ThumbnailImage] => (Binary data 4081 bytes, use -b option to extract)
            [PreviewImage] => (Binary data 40774 bytes, use -b option to extract)
            [ImageSize] => 1092x1572
            [Megapixels] => 1.7
        )

)


Is it possible to get CaptionAbstract into the array?
TIA

Phil Harvey

Without seeing the file I can't say exactly why it isn't extracting Caption-Abstract for you, but first off I would recommend updating to a recent version of ExifTool (version 10.10 is more than 5 years old).

If it doesn't work with the current version (or something greater than 12.00), send me the file and I'll take a look (philharvey66 at gmail.com)

- 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 ($).

gregc

Bingo!  Thanks Phil.  It works with the current (11.40) Windows portable.   

The old version is on Linux Mint 18 with current updates applied.

StarGeek

Quote from: gregc on March 30, 2021, 11:38:01 PM
Bingo!  Thanks Phil.  It works with the current (11.40) Windows portable. 

The current version is 12.22.  You can download it from the main page.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

gregc

Hmmm,... it's a bit more nefarious than that.  I updated the Linux Mint version from CPAN to 12.22, and got the same result.  The unexpected line wrap in the  [DateCreated] field made me wonder if it was tripping into some unwanted screen management.  This appears to be what is happening.  Piping the output thru hexdump -C - revealed the hidden output:


...
000004e0  20 5b 44 61 74 65 43 72  65 61 74 65 64 5d 20 3d  | [DateCreated] =|
000004f0  3e 20 31 39 39 39 3a 31  31 3a 31 39 0a 20 20 20  |> 1999:11:19.   |
00000500  20 20 20 20 20 20 20 20  20 5b 43 61 70 74 69 6f  |         [Captio|
00000510  6e 2d 41 62 73 74 72 61  63 74 5d 20 3d 3e 20 43  |n-Abstract] => C|
00000520  61 6d 65 72 61 3a 20 20  20 45 4f 53 20 44 32 30  |amera:   EOS D20|
00000530  30 30 43 0d 53 65 72 69  61 6c 20 23 3a 20 43 35  |00C.Serial #: C5|
00000540  32 30 43 2d 30 32 38 37  34 0d 57 69 64 74 68 3a  |20C-02874.Width:|
...


The 'internal' field delimiter inside Caption-Abstract is CR (0x0d), byte 0x533, so I guess this created an over-write.