Image display on dashboard

Hi all,
I am hoping this is easy but it's driving me insane. I am trying to show an image on my dashboard from a template node and have updated the settings file with httpStatic line, I've added the image to the referenced folder and included the code on the node (pictures attached). All I get is the error icon for the image. I've tried both .png and .jpg and the image is 2904 x 192.

Any ideas where I am going wrong?

The node-red is running on a LoRaWan gateway and version looks to be v0.15.2

I would suggest creating a directory for just for the shared content eg /public
Put your content in there, then change the httpStatic line to the FULL path to that location.
You shouldn't need the preceding / just the file name.

Cheers, I’ll give that a go and report back.

Use a seperate directory as @smcgann99 suggests.

This is the httpStatic line in my settings.js

httpStatic: '/home/pi/.node-red/node-red-static/',

I think the forum inserted those colours and italics, vi doesn't have them.

I find that I do have to precede filenames with / in my UI template.
The image file is /home/pi/.node-red/node-red-static/yr.no/weather.svg.

<div>
    <img src = "/yr.no/weather.svg"></img>
</div>

Cheers for your help - got it in the end. Not sure what fixed it but rewrote path, converted image to 150dpi and 24-bit and removed a few erroneous // and one of those things fixed it

Could you share the httpStatic line and the path you use to the image please ?

This was the line:

httpStatic: '/opt/nodered/node-red/images/',

The reason why it appears that the full path isn't displayed is that the instance is running on a LoRaWAN gateway rather than a computer with hdd.

What I actually found is that there is a secondary folder set up elsewhere on the gateway which node-red is pointing to for the image. Not sure why but I replaced the image in the second location with the correct one and it worked. I'll diagnose later as to why the image source points differently to what is in the setting file.

1 Like

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