Hello,
i need to use an image on a node red with no access to folders on it.
so i would like to use a base64 string(externally created) for displaying the image on an html entpoint.
my question:
is there an easy way to get that VERY big text into a node red variable?
If you are willing to try the Python way, start here:
Check your Python version but I would go for Python3 right away
Check your Python version: python3
Then install paho-mqtt as per instruction: pip3 install paho-mqtt
Below is a simple Python script based on one of mine. It is very simple, it takes the argument (path and file name of your image), connects to your MQTT broker (so yes, you need one as well or a MQTT cloud service, creates a bytearray of your image and sends it to a topic (images). In Node-RED you sbscribe to the same topic and use one of several image viewers. Like the example below
In the script you have to change the ip of the MQTT broker to make it work. To test from cmd line: python3 img_send.py -p path_and_name_of_image
Python script (read file, build MQTT Message, send MQTT Message) - > MQTT Broker -> NR subscribe (take payload, and display the image)
paho-mqtt is the necessary python client that you use to do MQTT connections/subscriptions/publishing. This is necessary to have. I found paho-mqtt working very well but there are other alternatives for Python as well like earlier mentioned mosquitto client. You also need to install a MQTT broker if you do not have it already. There are many hits if you google that
So ... i wasnt able to copy the big string to a function node, but it worked on a inject node
So i have the string in node red and can work with it ...narv
thx for youre ideas, maybe i will use that method to get other data to node red