rikukissa / node-red-contrib-image-output

🏞 Easy way of previewing and examining images in your flows
MIT License
13 stars 6 forks source link

node_status not blanked out when sending empty msg.payload + node_status not filled in when Resize images on server side #29

Closed juggledad closed 11 months ago

juggledad commented 1 year ago

NR V3.1.0-beta.4

1) when you send an empty msg.payload, the image is blanked but the node.status still shows the file name. You can fix this by sending a blank msg.file name. -- this can be corrected by adding a line to this code snippet in image.js (lines 81-85):

        // Reset the image in case an empty payload arrives
        if (!image || image === "") {
            sendImageToClient(null, msg);
            return;
        }

by changing it to this: // Reset the image in case an empty payload arrives if (!image || image === "") { node.status(""); // blank out the status <==== this line added sendImageToClient(null, msg); return; }

2) if you check the 'Resize images on server side' option, the status is not filled in with the path to the image. This can be corrected by commenting out a line in this code snippet (lines 93-106):

        if (node.thumbnail) {  
            if (isJimpObject(image)) {
                // Use the input Jimp image straight away, for maximum performance
                resizeJimpImage(image, msg);
            }
            else {
                if (!Buffer.isBuffer(image)) {
                    // Convert the base64 string to a buffer, so Jimp can process it
                    image = new Buffer.from(image.replace(/^data:image\/[a-z]+;base64,/, ""), 'base64');
                }
                oldimage = image;
                Jimp.read(image).then(function(jimpImage) {
                    resizeJimpImage(jimpImage, msg); 
                    // node.status("");               <==== comment out this line