0

I have a program that controls a camera which takes a capture and send it with MQTT to NodeRed. Here I have a the following package installed: node-red-contrib-image-tools With this I can show the image and save it in jpg and bmp format and open it... but I need to save several image files with different names...

Image saving and send to Dashboard

This is the node configurating that I have:

Image node configuration

And finally this is the node where I send the capture to Dashboard:

Image to Dashboard node configuration

hardillb
  • 54,545
  • 11
  • 67
  • 105

1 Answers1

0

I have resolved this problem taking the timestamp data and writting a "dynamic name" using this values.

Configuring dynamic name

And the code inside the top function block is: `

var now = new Date();
// Create formatted time
var yyyy = now.getFullYear();
var mm = now.getMonth() < 9 ? "0" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based
var dd  = now.getDate() < 10 ? "0" + now.getDate() : now.getDate();
var hh = now.getHours() < 10 ? "0" + now.getHours() : now.getHours();
var mmm  = now.getMinutes() < 10 ? "0" + now.getMinutes() : now.getMinutes();
var ss  = now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();

string_1.concat(string_2, string_3);
path = "c:/tfg-sensors-data/photos/" + "photo_num" + msg.count + "-" + yyyy + "-" + mm + "-" + dd + "-" + hh + "-" + mmm + "-" + ss + ".jpg";
msg.filename = path;
return msg;

`