ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: colweb on November 18, 2012, 05:20:11 AM

Title: output to php array gives less info
Post by: colweb on November 18, 2012, 05:20:11 AM
Hi all,

When I use the following command (in a terminal on Linux):
     exiftool -a -u -f -DSC_4397.JPG > 4397.txt
and then use:
     exiftool -a -u -f -php DSC_4397.JPG > 4397php.txt

and then compare the generated text files, the first (without '-php') has more info in it. Most of the extra info is actually double (like multiple times ISO) so that doesn't matter. But there are also some fields in 4397.txt that aren't in 4397php.txt. Missing in the second files is: X and Y Resolution, Resolution Unit, Sharpness, Contrast, Saturation, Lens F Stop and Y Cb Cr Positioning.

To get those fields also if I use -php do I need to other options or did something go wrong with the installation?

BTW, don't know if it is important for answering this question, but the jpg file is a photo taken with a Nikon D7000.
Title: Re: output to php array gives less info
Post by: Phil Harvey on November 18, 2012, 10:45:37 AM
From the -php documentation:

            The -g, -G, -sep and -struct options combine with -php in
            the same way as with -json.

and the -json documentation says:

            The -a option is implied if the -g or -G options are used,
            otherwise it is ignored and duplicate tags are suppressed.

This is an unavoidable by-product of the output format, because the hash keys must be unique.

About the missing XResolution, etc.  Are you sure you are looking at the same file?  I tried this with a D7000 JPG, and all of the tags you mention exist in the -php output from the command you gave (exiftool version 9.06).

- Phil
Title: Re: output to php array gives less info
Post by: colweb on November 18, 2012, 11:41:05 AM
Hi Phil,

I re-installed the whole thing and now I have those fields also in the php output. But something seems still missing. The text output has 277 lines while the php array contains 249 elements.

Line 75 of the text file has "Sharpness" with a number and quickly followed by Contrast and Saturation. Those are missing in the php output. I do have sharpness and so on, but only ones somewhere at the end (with a string value).

Is it somehow possible to get all 277 elements in the php array?

TIA,
Colweb
Title: Re: output to php array gives less info
Post by: Phil Harvey on November 18, 2012, 11:49:08 AM
Hi Colweb,

Try adding -G1 to both commands, and tell me if there are any differences in the resulting outputs.

- Phil

Edit: I tried this, and there are still some differences due to duplicate tags in the same group.  Adding the copy number to the groups with -G4:1 allows these to be distinguished.
Title: Re: output to php array gives less info
Post by: colweb on November 18, 2012, 12:18:43 PM
Hi Phil,

Used: exiftool -a -u -G4:1 -php DSC_4397.JPG

And now I get 274 elements in the php array. And I made a mistake with the number of lines in the text output. That file contains 274 lines as well. So both now have the same number of fields in it.

Thanks for helping me out here.

greetings,
Colweb
Title: Re: output to php array gives less info
Post by: Phil Harvey on November 18, 2012, 12:26:18 PM
Hi Colweb,

Quote from: colweb on November 18, 2012, 12:18:43 PM
And now I get 274 elements in the php array. Still 3 less then the text output, but the missing 3 are probably only doubles.

Odd.  All double values should be unique with the copy number in the group name.

I tried with a D7000 JPEG i have here, and this is what I get:

exiftool -a -u -G4:1 D7000.jpg --> 279 lines

exiftool -a -u -G4:1 -php D7000.jpg --> 282 lines

and these are the extra lines in the -php output:

Array(Array(
  "SourceFile" => "D7000.jpg",
));


- Phil
Title: Re: output to php array gives less info
Post by: colweb on November 18, 2012, 12:29:08 PM
Hi Phil,

I did edit my last post already. You are completely right that both (the text and php output) have the same number of elements now.

Thanks again.

greetings,
Colweb
Title: Re: output to php array gives less info
Post by: Phil Harvey on November 18, 2012, 12:33:14 PM
Ah, great.  The problems of replying too quickly... ;)

- Phil