How to MQTT image from Raspi using Base64 and Template node

Almost - you need the backticks above and below (on their own lines) (I'll edit it again)



I never said you were. I said ...

And I said that because you posted the following flow...





Anyhow, onto your issues...


there were a couple of things wrong. As I dont run an IBM Cloud instance, I have tweaked things around to get it working on a PI...

flow...

dashboard...

demo flow...

[{"id":"ed24352e.c554d8","type":"image viewer","z":"c966426a.35dc8","name":"","width":"140","data":"payload","dataType":"msg","x":1042,"y":768,"wires":[["3eed774d.91df08"]]},{"id":"e56b6718.c5d278","type":"ui_button","z":"c966426a.35dc8","name":"","group":"2a53ae0e.c22ef2","order":2,"width":0,"height":0,"passthru":false,"label":"Take Photo","tooltip":"","color":"","bgcolor":"","icon":"fa-camera-retro","payload":"","payloadType":"str","topic":"","x":1030,"y":224,"wires":[["44d58bbc.3abd14"]]},{"id":"44d58bbc.3abd14","type":"mqtt out","z":"c966426a.35dc8","name":"","topic":"myapp/control/take_photo","qos":"","retain":"","broker":"933bb4dd.225038","x":1438,"y":224,"wires":[]},{"id":"bc86bdb1.303a","type":"mqtt in","z":"c966426a.35dc8","name":"","topic":"myapp/response/photo","qos":"2","datatype":"auto","broker":"933bb4dd.225038","x":1060,"y":288,"wires":[["15d91d02.fed173","1b1a0556.14207b","19380c57.bd1cc4"]]},{"id":"3f79f384.ec8dfc","type":"ui_button","z":"c966426a.35dc8","name":"","group":"f80260c9.08249","order":2,"width":0,"height":0,"passthru":false,"label":"Take Photo","tooltip":"","color":"","bgcolor":"","icon":"fa-camera-retro","payload":"","payloadType":"str","topic":"","x":1030,"y":656,"wires":[["4fbf613a.54b1e"]]},{"id":"c9d1b497.260c58","type":"file in","z":"c966426a.35dc8","name":"","filename":"/home/pi/Pictures/photo1.JPEG","format":"","chunk":false,"sendError":false,"encoding":"none","x":1282,"y":704,"wires":[["2dbac17c.9187ee"]]},{"id":"254d0583.26b7ca","type":"inject","z":"c966426a.35dc8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1020,"y":704,"wires":[["c9d1b497.260c58"]]},{"id":"de31de65.7c008","type":"mqtt in","z":"c966426a.35dc8","name":"","topic":"myapp/control/take_photo","qos":"2","datatype":"auto","broker":"933bb4dd.225038","x":1070,"y":608,"wires":[["4fbf613a.54b1e"]]},{"id":"5c725d4e.c183e4","type":"mqtt out","z":"c966426a.35dc8","name":"","topic":"myapp/response/photo","qos":"","retain":"","broker":"933bb4dd.225038","x":1764,"y":704,"wires":[]},{"id":"ebaed7.94117128","type":"comment","z":"c966426a.35dc8","name":"IBM Cloud end","info":"","x":1040,"y":184,"wires":[]},{"id":"70abc57e.d9041c","type":"comment","z":"c966426a.35dc8","name":"Local end","info":"","x":1020,"y":560,"wires":[]},{"id":"15d91d02.fed173","type":"debug","z":"c966426a.35dc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1126,"y":336,"wires":[]},{"id":"1b1a0556.14207b","type":"image viewer","z":"c966426a.35dc8","name":"","width":"140","data":"payload","dataType":"msg","x":1490,"y":336,"wires":[[]]},{"id":"4fbf613a.54b1e","type":"camerapi-takephoto","z":"c966426a.35dc8","filemode":"0","filename":"photo1.JPEG","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"1","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","quality":"80","imageeffect":"none","exposuremode":"auto","iso":"0","agcwait":"1.0","led":"0","awb":"auto","name":"","x":1328,"y":656,"wires":[["2dbac17c.9187ee"]]},{"id":"2dbac17c.9187ee","type":"base64","z":"c966426a.35dc8","name":"","action":"str","property":"payload","x":1532,"y":704,"wires":[["5c725d4e.c183e4","ed24352e.c554d8","17502aa4.5e01f5"]]},{"id":"17502aa4.5e01f5","type":"debug","z":"c966426a.35dc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1798,"y":752,"wires":[]},{"id":"19380c57.bd1cc4","type":"template","z":"c966426a.35dc8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img height=\"320px\" src=\"data:image/jpg;base64,{{{payload}}}\">","output":"str","x":1340,"y":288,"wires":[["81bd5139.448d1"]]},{"id":"81bd5139.448d1","type":"ui_template","z":"c966426a.35dc8","group":"2a53ae0e.c22ef2","name":"","order":0,"width":"6","height":"7","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1484,"y":288,"wires":[[]]},{"id":"3eed774d.91df08","type":"template","z":"c966426a.35dc8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img height=\"320px\" src=\"data:image/jpg;base64,{{{payload}}}\">","output":"str","x":1196,"y":768,"wires":[["ea3320aa.dc7fd"]]},{"id":"ea3320aa.dc7fd","type":"ui_template","z":"c966426a.35dc8","group":"f80260c9.08249","name":"","order":0,"width":"6","height":"7","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1356,"y":768,"wires":[[]]},{"id":"2a53ae0e.c22ef2","type":"ui_group","name":"IBM Cloud","tab":"eb34fe8.0da08","order":2,"disp":true,"width":"6","collapse":false},{"id":"933bb4dd.225038","type":"mqtt-broker","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"f80260c9.08249","type":"ui_group","name":"Local","tab":"eb34fe8.0da08","order":1,"disp":true,"width":"6","collapse":false},{"id":"eb34fe8.0da08","type":"ui_tab","name":"Demo","icon":"dashboard","disabled":false,"hidden":false}]