Create a jpeg from camera snapshot URL - not working

Hi,

I have a foscam camera that provides a screenshot via the following url,

 http://192.168.1.170/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=myusername&pwd=mypassword

this then feeds into the following function which then goes into an email node. (I found this on the old google group forum, so it’s not something I have built myself)

[{"id":"24bd4c05.ab64a4","type":"change","z":"7141ede8.f151a4","name":"Flow 4 : Setup mail content","rules":[{"t":"set","p":"attachments","pt":"msg","to":"[{\t    \"filename\": 'camera_snapshot.jpg', \t    \"path\": '/tmp/local_image.jpg',\t    \"content\": $$.payload\t}]","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Result flow 4","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Dear,<br><br>Your PIR detector has detected movement in the living room.<br>In attachment you can find the file that was locally stored.<br><br>Kind regards,<br>Your Node-Red flow","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":480,"wires":[["8cde2b21.2ff708"]]}]

The problem I have is that the email created has a jpg file attached but it is not visible.when I try to open it.

Any ideas,

add debug nodes along the flow and check that the message being passed between the nodes looks correct.

Try saving the image using the file-out node, You really need to work out where along the flow it isn't working

Hi,

My flow has a debug, and it also tries to write the file to a local store too, which I can see in the directory - but when I try to open that - it does not open to something I can see.

Within one program i tried - I just get an exclamation mark come up, no other message.

It seems to create a file, of about 128kb; with a jpg extension but it’s it’s not something I can open/see.

Here is the flow..

The debug create a string something like the following.
To save space just the first part is provided below.

����JFIF���    ' .)10.)-,3:J>36F7,-@WAFLNRSR2>ZaZP`JQRO&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO&&O5-5OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

Did you set the return value of the http request to "a binary buffer"?

That did it !! Thanks @moebius

It works great now.

What does that binary buffer option do ?

It tells it to leave it as the raw binary data rather than trying, for example, to convert it to a string.