# Dashboard, ui\_media problem, with node code

**URL:** <https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567>\
**Category:** Dashboard\
**Created:** [13 March 2021 08:32 UTC](https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567 "2021-03-13T08:32:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![magnusso](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/magnusso/32/37680_2.png) [@magnusso](https://discourse.nodered.org/u/magnusso)\
**Post date:** [13 March 2021 08:32 UTC](https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567/1 "2021-03-13T08:32:24Z")

</div>

An suggestions of how to fix the following. The problem is that ui\_media accepts [https://http.cat/200.jpg](https://http.cat/200.jpg) but not [https://picsum.photos/200](https://picsum.photos/200), which returns a jpg.

```auto
[{"id":"20ddc3a5.ccea0c","type":"ui_media","z":"e2675bf3.39b0b8","group":"91aec0f.aaa5f4","name":"","width":0,"height":0,"order":11,"category":"","file":"","layout":"adjust","showcontrols":true,"loop":true,"onstart":false,"scope":"local","tooltip":"","x":1350,"y":460,"wires":[[]]},{"id":"131544e7.9dee4b","type":"inject","z":"e2675bf3.39b0b8","name":"","props":[{"p":"src","v":"https://picsum.photos/200","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1170,"y":460,"wires":[["20ddc3a5.ccea0c"]]},{"id":"1a1c469f.709cd9","type":"ui_media","z":"e2675bf3.39b0b8","group":"91aec0f.aaa5f4","name":"","width":0,"height":0,"order":11,"category":"","file":"","layout":"adjust","showcontrols":true,"loop":true,"onstart":false,"scope":"local","tooltip":"","x":1350,"y":500,"wires":[[x]]},{"id":"f261be4a.56a5","type":"inject","z":"e2675bf3.39b0b8","name":"","props":[{"p":"src","v":"https://http.cat/200.jpg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1170,"y":500,"wires":[["1a1c469f.709cd9"]]},{"id":"91aec0f.aaa5f4","type":"ui_group","name":"Default","tab":"85d2ae52.a0ed9","order":1,"disp":true,"width":"6","collapse":false},{"id":"85d2ae52.a0ed9","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![magnusso](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/magnusso/32/37680_2.png) [@magnusso](https://discourse.nodered.org/u/magnusso)\
**Post date:** [13 March 2021 08:34 UTC](https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567/2 "2021-03-13T08:34:19Z")

</div>

![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/ae6bcf9d4c5ce7dabb4777cac7fdbb30bb1979f7.jpeg)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 March 2021 09:21 UTC](https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567/3 "2021-03-13T09:21:29Z")

</div>

I dont use that node but with standard nodes, this works...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a516e5bec24541e6a480835987eb1d07560243ae.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b16953b10b7d354fd6766233c36f33e304a54dbb.jpeg)

```auto
[{"id":"16302fa9.75087","type":"function","z":"5d3f964c.fef898","name":"to base64 img","func":"\nmsg.payload = msg.payload.toString('base64');\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":2000,"wires":[["29f11527.839e1a"]]},{"id":"dd8f1ce6.3de7a","type":"http request","z":"5d3f964c.fef898","name":"","method":"GET","ret":"bin","paytoqs":"ignore","url":"https://picsum.photos/200","tls":"","persist":false,"proxy":"","authType":"","x":1090,"y":2000,"wires":[["16302fa9.75087"]]},{"id":"5b79d89b.5bf248","type":"inject","z":"5d3f964c.fef898","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":920,"y":2000,"wires":[["dd8f1ce6.3de7a"]]},{"id":"29f11527.839e1a","type":"template","z":"5d3f964c.fef898","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div>\n <img src=\"data:image/png;base64, {{{payload}}}\" />\n</div>","output":"str","x":1120,"y":2060,"wires":[["db91e0b6.fb0c6"]]},{"id":"db91e0b6.fb0c6","type":"ui_template","z":"5d3f964c.fef898","group":"da148e61.f015f","name":"","order":5,"width":"6","height":"6","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1290,"y":2060,"wires":[[]]},{"id":"da148e61.f015f","type":"ui_group","name":"Demo","tab":"da5706ae.6caf58","order":3,"disp":true,"width":"12","collapse":false},{"id":"da5706ae.6caf58","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [13 March 2021 09:39 UTC](https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567/4 "2021-03-13T09:39:14Z")

</div>

Have you read the HELP for the node?

> Input  
> payload object | string | Buffer  
> Selects which media will be displayed. It should be a string exactly like the Link field displays on the configuration panel, an object with the category and name properties, or a Buffer, whose content will be displayed according to the mimetype specified  
> Examples:
> 
> ```auto
> payload: "category/file name"
> }
>             
> {
> payload: {
> category: "category", 
> name: "file name"
> } 
> }
> 
> ```

```auto
     
Is that the format of the msg you are injecting??
```

---

<div class="post-metadata">

**Author:** ![magnusso](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/magnusso/32/37680_2.png) [@magnusso](https://discourse.nodered.org/u/magnusso)\
**Post date:** [13 March 2021 16:39 UTC](https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567/5 "2021-03-13T16:39:20Z")

</div>

@zenofmud, yes I have, the problem is that I'm trying to fetch an preview image from a Hikvision IP camera, [http://xxx.xxx.xxx.xxx/ISAPI/Streaming/channels/1/picture](http://xxx.xxx.xxx.xxx/ISAPI/Streaming/channels/1/picture), the path is fixes, so in essence there is no file name, just the path.

This is the problem that my simplifed example tries to illustrate.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 March 2021 17:24 UTC](https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567/6 "2021-03-13T17:24:22Z")

</div>

What comes out of the request node? Have you checked by adding a debug node?

Ps, did you try the flow I provided?

---

<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:** [12 April 2021 17:24 UTC](https://discourse.nodered.org/t/dashboard-ui-media-problem-with-node-code/42567/7 "2021-04-12T17:24:26Z")

</div>

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