Node-red getting image from network

Hello,

I would like to show an image on my dashboard.
The image(s) is located on a network share.
Node red is running on a ubuntu server.
I tried with node-red-contrib-image-tools but without success.
I would also like to handle it only with the template node.
Can I change the //httpstatic to link on a network drive?
Does anybody have an exsample how to do it?

Thanks TomyT

Use a file in node to read the remote share file. Set it to read a binary buffer. Once you have that working, pass the file buffer through a base64 node. Lastly, follow one of the many posts on the forum about displaying a base64 image in ui template.

But first, get the file loading from your network share into a buffer before worrying about displaying it (thats the easy part)

Hello,

thank you for the advice.
I installed samba on my ubuntu machine and created a shared folder. So i can put content from windows to that folder. I changed the settings.js httpstatic to this shared folder.
After that i was able to load files with file i node.
At the end I was also able to show the image on my dashboard.
But ist this really the way to go? For me (as a c# programmer) its a litte bit complicated.

Thanks TomyT

setting httpstatic allows you to serve files from the specified folder (like a web server does) - but it is NOT necessary to read a file.

For example, if you disable httpstatic and change the file in node to read an image from /tmp/test_image.png it will still work.

In essence, if you use httpstatic then your dashboard can simply access the image via a matching URL.

If you dont set httpstatic, then use need to use a file node to read the file and send it as base64 to the dashboard. OR serve the loaded file using http-in and http-response nodes.

OK, do you have an example flow how to load a file with http-in and http-response-nodes?

Check the node-red cookbook for examples. Also the flows library

E.g. Download a file from node-red using standard nodes (flow) - Node-RED

This :point_up: demo flow is for downloading a file )which is basically what an img tag does).

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