Page 1 of 1

Output data to text files etc.

Posted: 2016-11-14T15:32:15-07:00
by Bonzo
I am trying to get some image data into a php variable with success in some cases and not in others.

Please can somebody explain where the info will be going when using :- and 2>&1
What would I need to write the data to a text file?

Looking on the web I only need the stdout and not the error?

Code: Select all

magick -ping image.CR2 XMP:-

This works in the command line and I get a list of the XMP data.

Also with one of my tests ( I can not remember which one now ) in php I had the last line of the file <?xpacket end="w"?> Thinking about it I had a similar problem doing something and each line of the data was overwriting the previous one. Although that could have been when I was working on some Pi code as I have been trying that out lately as well.

Re: Output data to text files etc.

Posted: 2016-11-14T15:56:53-07:00
by snibgo
Bonzo wrote:Please can somebody explain where the info will be going when using :- and 2>&1

What would I need to write the data to a text file?
XMP:- will send the XMP text data to stdout.

If you also have 2>&1 then any text that would be sent to stderr will instead go to stdout.

If you want the XMP text data to go to a file instead of stdout, use a filename instead of the minus, eg XMP:myfile.txt

An alternative is to use >myfile.txt , but this will redirect all of stdout to the file, not just the XMP data.

Re: Output data to text files etc.

Posted: 2016-11-15T10:28:08-07:00
by Bonzo
Thank you for the information snibgo