# SVG node change image

**URL:** https://discourse.nodered.org/t/svg-node-change-image/59480
**Category:** General
**Created:** [7 March 2022 10:44 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480 "2022-03-07T10:44:16Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![funhall](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/funhall/32/36062_2.png) [@funhall](https://discourse.nodered.org/u/funhall)
#### Post date: [7 March 2022 10:44 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480/1 "2022-03-07T10:44:16Z")

</div>

Can someone help me how to change this image in the SVG node with a payload with the new link to the new image

[  
  ![Ingen tilgængelig billedbeskrivelse.](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9bb111cdef088b91cf4bb7d318c1aced6c49f0bb.jpeg)  
 ](https://www.facebook.com/photo/?fbid=10160137019283140&set=gm.3113049308953493& __cft__ %5B0%5D=AZXNlJnRRQIvID9VhPrJY2fPv0ZDnlVcR-1dvBpVK-JfqXmtpf2dqNNlUlq4D8wfVnA-8PX9i1SCPJpPDDNjfVfx6ql3UFseC3QK1NUn6TOMlF6DoZYm_1Awzv2VWJ4NUXO0Wu3FGJEpwbfk_fsbdG_l& __tn__ =EH-R)

Synes godt om

Kommenter

Del

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [7 March 2022 11:14 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480/2 "2022-03-07T11:14:59Z")

</div>

Hi @funhall,  
Have you tried anything (via [input msg](https://github.com/bartbutenaers/node-red-contrib-ui-svg/blob/master/docs/msg_control.md#updateset-an-attribute-value-via-msg)) and did it fail with some error?  
Bart

---

<div class="post-metadata">

### Author: ![funhall](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/funhall/32/36062_2.png) [@funhall](https://discourse.nodered.org/u/funhall)
#### Post date: [7 March 2022 11:21 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480/3 "2022-03-07T11:21:31Z")

</div>

Thank you so much for the fast reply. I really appreciate it.  
I have tried but dont think i did it right.  
I am not sure how to send that msg. Is it from a function node and do I have to change the syntax in the SVG node?  
Can you help with the flow please??. Here is the flow to import.

```auto
[
    {
        "id": "11efafb081448151",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "c6f5630c59d25f58",
        "type": "ui_svg_graphics",
        "z": "11efafb081448151",
        "group": "f014eb03.a3c618",
        "order": 1,
        "width": "14",
        "height": "13",
        "svgString": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0\" y=\"0\" height=\"100%\" viewBox=\"0 0 400 100\" width=\"100%\" preserveAspectRatio=\"xMidYMid meet\"><rect id=\"svgEditorBackground\" x=\"0\" y=\"0\" width=\"100\" height=\"100\" style=\"fill:none;stroke:none\"/><defs id=\"svgEditorDefs\"><style type=\"text/css\">.svg_text_unselect{-moz-user-select: none;-webkit-user-select: none;-ms-user-select: none;}\n</style></defs>\n<!-- Add here your SVG shapes (circles, rectangles, ...) -->\n<!-- Or remove everything, if you want to paste an entire drawing (<svg...>...</svg>).-->\n<image x=\"-16.6269\" y=\"-65.2529\" width=\"396.714\" height=\"225.902\" id=\"e1_image\" preserveAspectRatio=\"xMidYMid meet\" xlink:href=\"https://funhall.dk/wp-content/uploads/2022/03/escape-rum-1-timer.jpg\" transform=\"matrix(1.09797 0 0 1 -11.6156 4.80591)\"/><text style=\"fill:white;font-size:40px;font-weight:bold;text-anchor:end;font-style:normal;font-family:&quot;Bookman Old Style&quot;\" x=\"378.779\" y=\"64.0543\" id=\"e3_texte\" xml:space=\"preserve\" class=\"svg_text_unselect\"> {{msg.payload}}</text><text style=\"fill:white;font-size:8px;font-weight:bold;text-anchor:end;font-style:normal;font-family:&quot;Bookman Old Style&quot;\" x=\"376.532\" y=\"124.14\" id=\"e2_texte\" xml:space=\"preserve\"> Penalty: {{msg.penalty}} min.</text><text style=\"fill:black;font-family:Arial;font-size:20px\" x=\"-8.666\" y=\"-40.668\" id=\"e1_texte\"/><text style=\"fill:white;font-family:Bookman Old Style;font-size:20px\" x=\"8.63731\" y=\"-26.9142\" id=\"e4_texte\">{{msg.hintHead}}</text><text style=\"fill:white;font-family:Bookman Old Style;font-size:8px\" x=\"8.41543\" y=\"-1.18169\" id=\"e5_texte\" xml:space=\"preserve\" textLength=\"61.85085449921053\" transform=\"matrix(0.75 0 0 0.75 7.64142 -1.60601)\"/><text style=\"fill:white;font-family:Bookman Old Style;font-size:8px\" x=\"10.5235\" y=\"-4.52878\" id=\"e6_texte\">{{msg.hint}}</text></svg>",
        "clickableShapes": [],
        "javascriptHandlers": [],
        "smilAnimations": [],
        "bindings": [],
        "showCoordinates": false,
        "autoFormatAfterEdit": false,
        "showBrowserErrors": false,
        "showBrowserEvents": false,
        "enableJsDebugging": false,
        "sendMsgWhenLoaded": false,
        "noClickWhenDblClick": false,
        "outputField": "payload",
        "editorUrl": "//drawsvg.org/drawsvg.html",
        "directory": "",
        "panning": "disabled",
        "zooming": "disabled",
        "panOnlyWhenZoomed": false,
        "doubleClickZoomEnabled": false,
        "mouseWheelZoomEnabled": false,
        "dblClickZoomPercentage": 150,
        "cssString": "div.ui-svg svg{\n color: var(--nr-dashboard-widgetColor);\n fill: currentColor !important;\n}\ndiv.ui-svg path {\n fill: inherit;\n}",
        "name": "timer screen",
        "x": 610,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "b7b5192eb1b2d231",
        "type": "inject",
        "z": "11efafb081448151",
        "name": "Picture",
        "props": [
            {
                "p": "image",
                "v": "https://funhall.dk/wp-content/uploads/2022/03/escape-rum-1-timer.jpg",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0\" y=\"0\" height=\"100%\" viewBox=\"0 0 400 100\" width=\"100%\" preserveAspectRatio=\"xMidYMid meet\"><rect id=\"svgEditorBackground\" x=\"0\" y=\"0\" width=\"100\" height=\"100\" style=\"fill:none;stroke:none\"/><defs id=\"svgEditorDefs\"><style type=\"text/css\">.svg_text_unselect{-moz-user-select: none;-webkit-user-select: none;-ms-user-select: none;} </style></defs> <!-- Add here your SVG shapes (circles, rectangles, ...) --> <!-- Or remove everything, if you want to paste an entire drawing (<svg...>...</svg>).--> timer screen / <image x=\"-16.6269\" y=\"-65.2529\" width=\"396.714\" height=\"225.902\" id=\"e1_image\" preserveAspectRatio=\"xMidYMid meet\" xlink:href=\"https://funhall.dk/wp-content/uploads/2022/03/escape-rum-1-timer.jpg\" transform=\"matrix(1.09797 0 0 1 -11.6156 4.80591)\"/><text style=\"fill:white;font-size:40px;font-weight:bold;text-anchor:end;font-style:normal;font-family:&quot;Bookman Old Style&quot;\" x=\"378.779\" y=\"64.0543\" id=\"e3_texte\" xml:space=\"preserve\" class=\"svg_text_unselect\"> {{msg.payload}}</text><text style=\"fill:white;font-size:8px;font-weight:bold;text-anchor:end;font-style:normal;font-family:&quot;Bookman Old Style&quot;\" x=\"376.532\" y=\"124.14\" id=\"e2_texte\" xml:space=\"preserve\"> Penalty: {{msg.penalty}} min.</text><text style=\"fill:black;font-family:Arial;font-size:20px\" x=\"-8.666\" y=\"-40.668\" id=\"e1_texte\"/><text style=\"fill:white;font-family:Bookman Old Style;font-size:20px\" x=\"8.63731\" y=\"-26.9142\" id=\"e4_texte\">{{msg.hintHead}}</text><text style=\"fill:white;font-family:Bookman Old Style;font-size:8px\" x=\"8.41543\" y=\"-1.18169\" id=\"e5_texte\" xml:space=\"preserve\" textLength=\"61.85085449921053\" transform=\"matrix(0.75 0 0 0.75 7.64142 -1.60601)\"/><text style=\"fill:white;font-family:Bookman Old Style;font-size:8px\" x=\"10.5235\" y=\"-4.52878\" id=\"e6_texte\">{{msg.hint}}</text></svg>",
        "x": 290,
        "y": 240,
        "wires": [
            [
                "c6f5630c59d25f58"
            ]
        ]
    },
    {
        "id": "1944fd142ff7fe72",
        "type": "inject",
        "z": "11efafb081448151",
        "name": "Test picture 1",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "https://funhall.dk/wp-content/uploads/2022/02/kaffe-frugtfad-3-scaled.jpg",
        "payloadType": "str",
        "x": 290,
        "y": 360,
        "wires": [
            [
                "c6f5630c59d25f58"
            ]
        ]
    },
    {
        "id": "f014eb03.a3c618",
        "type": "ui_group",
        "name": "Floorplan test",
        "tab": "80068970.6e2868",
        "order": 1,
        "disp": true,
        "width": "14",
        "collapse": false
    },
    {
        "id": "80068970.6e2868",
        "type": "ui_tab",
        "name": "SVG",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

Btw. i have other payload msg into the SVG node.

---

<div class="post-metadata">

### Author: ![funhall](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/funhall/32/36062_2.png) [@funhall](https://discourse.nodered.org/u/funhall)
#### Post date: [7 March 2022 11:59 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480/4 "2022-03-07T11:59:04Z")

</div>

I now tryed this with no luck. Can you see what I am doing wrong.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/249968785c62291c9eeb1020bf9923f352971c3a.png)

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [7 March 2022 12:17 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480/5 "2022-03-07T12:17:46Z")

</div>

I will have a look tonight. Now at work.

---

<div class="post-metadata">

### Author: ![funhall](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/funhall/32/36062_2.png) [@funhall](https://discourse.nodered.org/u/funhall)
#### Post date: [7 March 2022 12:23 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480/6 "2022-03-07T12:23:10Z")

</div>

Thanks you so much......

---

<div class="post-metadata">

### Author: ![funhall](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/funhall/32/36062_2.png) [@funhall](https://discourse.nodered.org/u/funhall)
#### Post date: [7 March 2022 13:13 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480/7 "2022-03-07T13:13:17Z")

</div>

I just figure it out.  
But thanks anyway

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [21 March 2022 13:13 UTC](https://discourse.nodered.org/t/svg-node-change-image/59480/8 "2022-03-21T13:13:25Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
