Add image in the help file

Hello all, i think having the possibility to add image in the HTML file for the help section (data-help-name) would be a nice feature by using the HTML img marking for example.
Sometime word can't explain everything and an image could be usefull.

currently being discussed in Add image in Node help html file

3 Likes

Of course but this is a feature request.
The other post is more a way around.

There is not really a need for a new feature since this is easily dealt with using existing capabilities.

1 Like

The question is if each node has to create its own admin endpoint just to display an image or if there is not an easy way out of the box of node-red for that.

Maybe that automatically image files (png, svg, jpg, gif) will be served by the server a specific directory of the node.

1 Like

Well, there is a build in method (sort of) in that any custom node can add a static folder to serve things from, no need for an admin API end-point if you don't want to. This is the advantage of Node-RED using ExpressJS. The only real disadvantage of adding a static folder is that you could get name clashes with files in other folders..

Anything you want NR to serve up has to be mapped to a folder. For a custom node, you have to decide where that folder will be and make sure it exists. While you could copy a file into an existing mapped folder, it would probably be overwritten on an upgrade. You really have to take control of it yourself.

Or as was mentioned in the linked discussion you can inline images with base64 encoding or svg - so no endpoint needed.

There has long been a need to do something in this area - ever since Ben published his Geofence node in the very early days of NR and asked how to include the leaflet.js libraries in the editor. So this isn't limited to just images in the help.

Adding an endpoint is a work around to the fact we don't provide an automatic way of doing it.

The solution would be something along the lines of adding extra metadata in the node's package.json file to identify a folder to automatically serve content from - which would be made available under some predefined path that uses the module name as part of the path to ensure uniqueness.

We've just never put pen to paper to create a proper design for it and make it happen.

2 Likes

Well that would be interesting and a nice addition to Node-RED though given that it is relatively easy to add to a custom node anyway, I would have to wonder how far up the priority tree it should be?

Messing with uibuilder v2 has certainly given me a decent appreciation of how to do this and I'm convinced I still don't have things absolutely right - I'm expecting to make some further improvements in a future release. Serving up a static folder is really easy. Unserving it is crazy hard - but that is down to how ExpressJS works, not Node-RED. Thankfully, I now have some utilities that let me process the list of served endpoints and suitably remove things.

Well, Ben published his geofence node ~5 years ago which first raised the question. So no, it hasn't been far up the list. But there are countless small things on the backlog that are not high priority in themselves, but each one adds to a nicer overall experience.