Dashboard, ui_media problem, with node code

An suggestions of how to fix the following. The problem is that ui_media accepts https://http.cat/200.jpg but not https://picsum.photos/200, which returns a jpg.

[{"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}]

Capture

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

image

image

[{"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}]

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:

    payload: "category/file name"
}
            
{
    payload: {
        category: "category", 
        name: "file name"
    } 
}
     
Is that the format of the msg you are injecting??

@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, 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.

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

Ps, did you try the flow I provided?

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