Usb camera image sent to email with preview

Hi,
I got this flow so far, managed to send the image from the usbcamera to email, but the image is corrupted and can't be previewed.

[{"id":"f2af706c.c79d","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"77239d67.85b084","type":"usbcamera","z":"f2af706c.c79d","filemode":"1","filename":"image02.jpg","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"2","name":"","x":330,"y":340,"wires":[["e1b37777.2fb2d8"]]},{"id":"3c738fdc.5a33a","type":"e-mail","z":"f2af706c.c79d","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"zamfiralex98@gmail.com","dname":"email","x":650,"y":260,"wires":[]},{"id":"3be15ba7.2bd0b4","type":"e-mail in","z":"f2af706c.c79d","name":"","protocol":"IMAP","server":"imap.gmail.com","useSSL":true,"autotls":"never","port":"993","box":"INBOX","disposition":"Read","criteria":"UNSEEN","repeat":"300","fetch":"auto","inputs":0,"x":210,"y":520,"wires":[[]]},{"id":"597850a6.c46aa","type":"debug","z":"f2af706c.c79d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":140,"wires":[]},{"id":"ddb4c0c.462a74","type":"image","z":"f2af706c.c79d","name":"","width":160,"data":"payload","dataType":"msg","thumbnail":false,"active":true,"pass":false,"outputs":0,"x":640,"y":500,"wires":[]},{"id":"b50ebbe0.ca4ae8","type":"inject","z":"f2af706c.c79d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":160,"y":340,"wires":[["77239d67.85b084"]]},{"id":"8422abc7.ad2738","type":"function","z":"f2af706c.c79d","name":"","func":"msg = {\n    to: \"zamfiralex98@gmail.com\",\n    topic: `Atentie, miscare detectata @ ${Date()}`,\n    payload: msg.payload,\n    filename: \"image02.jpg\"\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":260,"wires":[["3c738fdc.5a33a","597850a6.c46aa"]]},{"id":"e1b37777.2fb2d8","type":"http request","z":"f2af706c.c79d","name":"","method":"GET","ret":"bin","paytoqs":"ignore","url":"https://example.com{{{data.attributes.entity_picture}}}","tls":"","persist":false,"proxy":"","authType":"basic","x":310,"y":260,"wires":[["8422abc7.ad2738"]]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.