How to show local html file with images?

Hello there!

I have Node-red dashboard system under Ubuntu and it's used also to show reciept html template that goes to printer. Template have images and custom fonts in it but http response node don't show it. I've tried relative and absolute paths but it didn't work. Of course, user have permission to read data from directories. Please help me with this.

You will need to share some more info. Also look at the browser dev console to see if it is reporting any errors and share those.

In your title, you say "local html file" - local to where? The client or the Node-RED server?

Where have you put the images and font files?

It's local to PC node red is running of course.

Let's say: I have html file on disk in some directory. /opt/recipe in this case.
Inside of /opt/recipe I have recipe.html and recipe.png files.
recipe.png is used inside of recipe.html.

Now, I've use nodes to show it on a page:
http in->file in->http response

And there's no graphics on page as a result.

I wouldn't have asked if that were the case.

OK, though somewhat odd location for Linux, you will need to make sure you have the permissions for the folder set correctly.

Now you've shared that info, your issue makes sense.

http-in/-out does not provide folder sharing. So you've only made available a single file by manually importing it and manually returning it.

Node-RED has several ways to make resource files available. For example, there is a property in settings.js that lets you define a specific folder (and its sub-folders) to serve up. See the comments in the settings file.

However, if you want to have a full web service, you would likely be better off using node-red-contrib-uibuilder. That provides a complete service including html, css, js and other file types. Assuming that you include the provided front-end library, you also get interactive communications between the web pages and Node-RED and you can use it to edit pages, serve up 3rd-party front-end libraries and much more.

As always with Node-RED, the choice is yours.

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