ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: bquimby1 on May 17, 2020, 05:51:08 PM

Title: Embedded LF characters in Caption-Abstract
Post by: bquimby1 on May 17, 2020, 05:51:08 PM
I'm trying to embed LF characters in the Caption-Abstract data so when I retrieve it  I have formatted output (paragraphs).  I'm using a Perl script to update my photos' metadata and it looks like ExifTool is stripping the LFs out on input.  Is there a way to tell ExifTool NOT to strip them out?

Update:  I've determined that exiftool is not stripping the LFs and is storing them in the Caption-Abstract data as intended.  However when I try and print it back I'm getting '..' instead of 'LFLF' unless I use the -b switch.   The -b switch works well as long as I'm only asking to retrieve text data tags.   I like to use `exiftool -S -sort -n someimage.jpg`  (for example) to get all the tags associated with an image and then grab the tags as needed.  Is there a way to get exiftool to print the LFs as LFs and not .s (in text tags) while printing the binary tags in readable form?

Update (again):  When I upload an image to FaceBook the LFs are translated as I intended.

This is how I use PHP to retrive metadata:


$this->exiftooldata=[];
exec("/usr/local/bin/exiftool -S -sort -n " . $filename,$this->exiftooldata,$returncode);

Title: Re: Embedded LF characters in Caption-Abstract
Post by: StarGeek on May 17, 2020, 08:30:49 PM
How are you trying to set the data?  Through the Perl api?  If so, it would be helpful to share a snippet of the appropriate code.

If you're calling exiftool from the command line, see FAQ #21 (https://exiftool.org/faq.html#Q21).
Title: Re: Embedded LF characters in Caption-Abstract
Post by: bquimby1 on May 18, 2020, 03:01:19 PM
FAQ #21 did the job!  Everything is working using  'exiftool -php -q $filename' options in a PHP eval.  Thank You!  Thank You!

More specifically:


$this->exiftooldata=[];
eval('$this->exiftooldata=' . `/usr/local/bin/exiftool -php -q $this->filename` );
foreach ( $this->exiftooldata as $a ) {
  foreach ( $a as $tag => $data ) {
$this->tagdata[$tag] = $data;
  }
}