QR code on dashboard via data URL

Hello,
I'm working on a project where I generate a QR code and want to display it in my dashboard. Unfortunately, this isn't working.
I can generate the QR code, but I can't display it via a template node.
I'm using the "node-red-contrib-qrcode-generator" to generate the QR code.

This generates a data URL, but I can't display it.
If I place the link in the template node, it works, but as soon as I make it dynamic with the URL as msg.payload, it stops working and I see a strange icon.
Does anyone know what I'm doing wrong and how I can fix this?
Thanks in advance!

This is my current flow:

[
    {
        "id": "5db07db4ad84b11e",
        "type": "qrcode-generator",
        "z": "59d74dfb2578e436",
        "name": "",
        "qrtype": "text2qr",
        "text2qrText": "",
        "ssid": "",
        "hiddenssid": false,
        "wifitype": "",
        "phonenum": "",
        "smsphonenum": "",
        "smstext": "",
        "mailto": "",
        "mailsubject": "",
        "mailbody": "",
        "latitude": "",
        "longitude": "",
        "colorlight": "#ffffff",
        "colordark": "#000000",
        "printstatus": false,
        "x": 750,
        "y": 160,
        "wires": [
            [
                "a01e0eec311b75da"
            ]
        ]
    },
    {
        "id": "b359e5c2fb3d386f",
        "type": "inject",
        "z": "59d74dfb2578e436",
        "name": "",
        "props": [
            {
                "p": "qrcodeinput",
                "v": "hello_world",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 530,
        "y": 160,
        "wires": [
            [
                "5db07db4ad84b11e"
            ]
        ]
    },
    {
        "id": "72d7fd304c41ce7b",
        "type": "debug",
        "z": "59d74dfb2578e436",
        "name": "debug 4",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 790,
        "y": 380,
        "wires": []
    },
    {
        "id": "a01e0eec311b75da",
        "type": "ui-template",
        "z": "59d74dfb2578e436",
        "group": "814c61671a035281",
        "page": "",
        "ui": "",
        "name": "",
        "order": 1,
        "width": 0,
        "height": 0,
        "head": "",
        "format": "<div style=\"white-space: pre-wrap; word-wrap: break-word; max-height: 250px; overflow-y: auto; padding: 10px; border: 1px solid #ccc; border-radius: 10px;\">\n  <h3></h3>\n  <img src=\"{{msg.payload}}\" style=\"max-width:100%; height:auto;\">\n</div>",
        "storeOutMessages": true,
        "passthru": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 800,
        "y": 260,
        "wires": [
            [
                "72d7fd304c41ce7b"
            ]
        ]
    },
    {
        "id": "814c61671a035281",
        "type": "ui-group",
        "name": "Welkom!",
        "page": "75a598be68292179",
        "width": "12",
        "height": "4",
        "order": 1,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false",
        "groupType": "default"
    },
    {
        "id": "75a598be68292179",
        "type": "ui-page",
        "name": "Home",
        "ui": "44e48157b09337b1",
        "path": "/home",
        "icon": "home",
        "layout": "grid",
        "theme": "7b56f3f25e965ad4",
        "breakpoints": [
            {
                "name": "Default",
                "px": "0",
                "cols": "3"
            },
            {
                "name": "Tablet",
                "px": "576",
                "cols": "6"
            },
            {
                "name": "Small Desktop",
                "px": "768",
                "cols": "9"
            },
            {
                "name": "Desktop",
                "px": "1024",
                "cols": "12"
            }
        ],
        "order": 1,
        "className": "",
        "visible": true,
        "disabled": false
    },
    {
        "id": "44e48157b09337b1",
        "type": "ui-base",
        "name": "JServer",
        "path": "/dashboard",
        "appIcon": "http://192.168.178.20:1880/DMX512.JPG",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control",
            "ui-switch",
            "ui-text",
            "ui-form",
            "ui-slider",
            "ui-button-group",
            "ui-template"
        ],
        "showPathInSidebar": false,
        "headerContent": "page",
        "navigationStyle": "default",
        "titleBarStyle": "default",
        "showReconnectNotification": true,
        "notificationDisplayTime": "5",
        "showDisconnectNotification": true,
        "allowInstall": true
    },
    {
        "id": "7b56f3f25e965ad4",
        "type": "ui-theme",
        "name": "Default Theme",
        "colors": {
            "surface": "#000000",
            "primary": "#191919",
            "bgPage": "#252525",
            "groupBg": "#ffffff",
            "groupOutline": "#000000"
        },
        "sizes": {
            "density": "default",
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    }
]

icon that appears when I try to generate the qr code dynamically:

icon that appears when I try to generate the qr code dynamically

I use image tools instead which renders a barcode in a template node (using an inline image)

[{"id":"a9f39e6ddf82e130","type":"Barcode Generator","z":"8d1ca836d84524bc","name":"","data":"payload","dataType":"msg","barcode":"qrcode","barcodeType":"barcode","options":"","optionsType":"ui","sendProperty":"payload","props":[{"p":"rotate","v":"N","vt":"str"},{"p":"includetext","v":"true","vt":"bool"},{"p":"textxalign","v":"center","vt":"str"}],"x":540,"y":1120,"wires":[["092c279ce0410e49","609a53ae7ad98d8f"]]},{"id":"092c279ce0410e49","type":"image viewer","z":"8d1ca836d84524bc","name":"","width":160,"data":"payload","dataType":"msg","active":true,"x":710,"y":1160,"wires":[[]]},{"id":"51510e146dd0f2ca","type":"inject","z":"8d1ca836d84524bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"hello","payloadType":"str","x":360,"y":1120,"wires":[["a9f39e6ddf82e130"]]},{"id":"609a53ae7ad98d8f","type":"jimp-image","z":"8d1ca836d84524bc","name":"","data":"payload","dataType":"msg","ret":"b64","parameter1":"","parameter1Type":"msg","parameter2":"","parameter2Type":"msg","parameter3":"","parameter3Type":"msg","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","sendProperty":"payload","sendPropertyType":"msg","parameterCount":0,"jimpFunction":"none","selectedJimpFunction":{"name":"none","fn":"none","description":"Just loads the image.","parameters":[]},"x":710,"y":1080,"wires":[["78de6067504e06b7"]]},{"id":"78de6067504e06b7","type":"ui-template","z":"8d1ca836d84524bc","group":"2e63deabd3e8b97d","page":"","ui":"","name":"","order":1,"width":"4","height":"3","head":"","format":"<template>\n    <div class=\"hello\">\n        <h1>hello</h1>\n       <img height=\"100%\"   :src=\"msg.payload\"/>\n    </div>\n</template>\n","storeOutMessages":true,"passthru":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":860,"y":1080,"wires":[[]]},{"id":"2e63deabd3e8b97d","type":"ui-group","name":"Group Name","page":"23ee792ee85ece22","width":6,"height":1,"order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"23ee792ee85ece22","type":"ui-page","name":"barcode","ui":"9fe4d11060c4b9e1","path":"/page5","icon":"home","layout":"grid","theme":"4b38205e56f477cf","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":1,"className":"","visible":"true","disabled":"false"},{"id":"9fe4d11060c4b9e1","type":"ui-base","name":"My Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","notificationDisplayTime":5},{"id":"4b38205e56f477cf","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"compact","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}},{"id":"61a963a446464bb6","type":"global-config","env":[],"modules":{"node-red-contrib-image-tools":"2.1.1","@flowfuse/node-red-dashboard":"1.26.0"}}]

1 Like

Thanks for your quick response. This is exactly what I meant!