Show random local images on dashboard

Hi,

I am new to Node Red. May I get help from you.

On local folder I want to place 200 Images.
Named 1.png, 2.png etc. Every 10 second, a random picture 1.png or 189.png should be shown.

OK, with the "random"-node, no problem.
I try to build my complete path to the imagefile called "1.png" with concatting the output of "random"-node and my local picture path (e.g. /home/pi/Pictures/1.png) but it does not work. For some reason, I could not build the output.

And the second problem is, how can I show that image on my dashboard? It shoud be possible, that a person, who is browsing to localhost:1880/ui/(random path)
should see my imagesin fullscreen.

Thank's in advance.

Tanner

This came up in another thread recently. It is quite simple, you have given a filing system path instead of a URL path. The two things are different and you need to mentally convert between them when you are coding.

To serve up a bunch of static files (like images are), you configure the static folder in settings.js.

Assuming you haven't changed anything else in settings.js:

If you set the static path to:

/home/pi/Pictures

those files will then be available on the url:

http://<node-red-server-ip>:1880/1.png

and so on.

Because your Dashboard is already served from http://<node-red-server-ip>:1880/ui, you can shorten the URL's down to /1.png

1 Like

Thank you very much!