I'm trying to set an image in the dashboard via a http-request node:
[{"id":"c6754549.347f68","type":"http request","z":"7fe54cbf.cae6f4","name":"","method":"GET","ret":"bin","url":"http://192.168.178.26/api/camera/snapshot?width=640&height=480","tls":"","x":510,"y":1180,"wires":[["976113b.77371f"]]},{"id":"437fc727.cdf9","type":"inject","z":"7fe54cbf.cae6f4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":360,"y":1180,"wires":[["c6754549.347f68"]]},{"id":"976113b.77371f","type":"function","z":"7fe54cbf.cae6f4","name":"","func":"var original_data = msg.payload;\nvar base64Image = original_data.toString('base64');\nvar decodedImage = new Buffer(base64Image, 'base64');\n//msg.payload = decodedImage;\n//msg.payload = encodeURI(decodedImage);\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":1180,"wires":[["8e580a7f.1806f8","2c67e571.1aea02"]]},{"id":"8e580a7f.1806f8","type":"ui_template","z":"7fe54cbf.cae6f4","group":"4fd946d4.f8b7","name":"","order":0,"width":0,"height":0,"format":"<img ng-src=\"msg.payload\" />","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":800,"y":1140,"wires":[[]]},{"id":"2c67e571.1aea02","type":"ui_template","z":"7fe54cbf.cae6f4","group":"4fd946d4.f8b7","name":"","order":0,"width":0,"height":0,"format":"<script>\n var imageObj; \n (function(scope){ \n scope.$watch('msg', function(msg) {\n imageObj.src = msg.payload;\n });\n })(scope);\n\n var canvas = document.getElementById('myCanvas');\n var context = canvas.getContext('2d');\n var imageObj = new Image();\n context.drawImage(imageObj, 578, 400);\n\n</script>\n<canvas id=\"myCanvas\" width=\"578\" height=\"400\"></canvas>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":800,"y":1220,"wires":[[]]},{"id":"4fd946d4.f8b7","type":"ui_group","name":"Group 2","tab":"ea722d0f.98c548","order":2,"disp":true,"width":6},{"id":"ea722d0f.98c548","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1}]
I cannot manage to show the image. Putting the link directly inside a <img src=... />
tag works. Sending the payload via an email node, gives a valid jpg as attachment, it just won't show in the dashboard.
The example above shows some of my attempts but obviously I'm missing something. Any pointer would be appreciated.
Edit: Using NR 0.18.7