ExifTool Forum

ExifTool => Newbies => Topic started by: machouinard on March 01, 2012, 05:16:03 PM

Title: Extracting ThumbnailImage Creates UnViewable File
Post by: machouinard on March 01, 2012, 05:16:03 PM
I can generate files which appear to be the correct size using this with PHP:

`exiftool -b ThumbnailImage $image>$thumb`

but I'm unable to view them.  I read here (https://exiftool.org/forum/index.php/topic,2161.msg9515.html#msg9515) about the age-old newline problem. This code was included in the post:

   open (OUT, '>perl.jpg') or die "cannot open perl.jpg";
        binmode OUT;
   print OUT $$val;

Am I looking in the right direction?  If so, how would I go about fixing this in a PHP environment?

Thanks,
Mark
Title: Re: Extracting ThumbnailImage Creates UnViewable File
Post by: Phil Harvey on March 02, 2012, 12:19:57 AM
You don't need to worry about the binmode.  ExifTool sets that automatically when you use the -b option.  There must be something else going on here, but I don't know what. (Other than the missing "-" in the "-thumbnailimage" argument.)

Did you check the messages that exiftool returns?

- Phil
Title: Re: Extracting ThumbnailImage Creates UnViewable File
Post by: machouinard on March 03, 2012, 08:09:11 PM
Tried -thumbnailimage -b but all I got were 0 byte files.  Switched to -thumbnailimage -b and it worked a charm.

Thanks, Phil!
Title: Re: Extracting ThumbnailImage Creates UnViewable File
Post by: Phil Harvey on March 04, 2012, 06:09:08 AM
Quote from: machouinard on March 03, 2012, 08:09:11 PM
Tried -thumbnailimage -b but all I got were 0 byte files.  Switched to -thumbnailimage -b and it worked a charm.

? That's the same thing.

- Phil
Title: Re: Extracting ThumbnailImage Creates UnViewable File
Post by: machouinard on March 05, 2012, 05:49:14 AM
My mistake.  When I added the missing - to the code in my first post:
`exiftool -b ThumbnailImage $image>$thumb`
I was getting files with 0 bytes.  Just had to place the -b after -thumbnailimage.

Mark
Title: Re: Extracting ThumbnailImage Creates UnViewable File
Post by: Phil Harvey on March 05, 2012, 07:21:26 AM
Hi Mark,

The order doesn't matter.  -thumbnailimage -b is the same as -b -thumbnailimage.

So something else must have been going on.  I suspect that you accidently misspelled thumbnailimage in one command.

- Phil