Embedded LF characters in Caption-Abstract

Started by bquimby1, May 17, 2020, 05:51:08 PM

Previous topic - Next topic

bquimby1

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);


StarGeek

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.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

bquimby1

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;
  }
}