Image from Item?

I’m testing my Russound binding and have encountered an ?issue? with the Image. Russound provides a cover art URL for the song currently playing. I had hoped to simply do “Image item=[myitem]” (where the item is a string type containing the url) and have the cover image displayed. However, I’m getting a nullpointerexception in ProxyServlet because I’m missing the “url” attribute of the image. Is there a way to display an image from a stringtype?

Example (sitemap):
Text item= Rio_Src_Cover
Image item= Rio_Src_Cover

Example (item):
String Rio_Src_Cover “Cover Art [%s]” { channel=“russound:source:1:coverarturl” }

In the classic ui I get

and I get the following exception:

    2016-09-06 10:39:51.513 [WARN ] [e.jetty.servlet.ServletHandler:628  ] - /proxyjava.lang.NullPointerException: null
    	at java.net.URI$Parser.parse(Unknown Source)
    	at java.net.URI.(Unknown Source)
    	at java.net.URI.create(Unknown Source)
    	at org.eclipse.smarthome.ui.internal.proxy.ProxyServlet.doGet(ProxyServlet.java:162)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    	at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
    	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
    	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)

I’ve never tried to use an Image using an Item instead of the url element. If you put that URL in the url tag, does it work?

If it does then the problem is the Image element is not able to use the state of your String Item as the URL to grab the Image from. :frowning:

Yes the URL does work in the url attribute. It’s actually a pretty simple change in ProxyServlet to support (psuedo code: if the url is null, get the item and if it’s state is a StringType - put the value into the uriString field). Works for both Image and Video widgets. I have it changed locally (although I’m not sure how to create a jar out of it to test - still getting my head around how all this fits together). If Kai or someone wants me to put in a pull request for it - let me know…

Hi all,

@tmrobert8 Your soloution sounds nice. Is it possible to give us some hints how to do that changes ourselves (preferable for OH2)

thanks in advance
Simon

Simon,

You’d need to modify the source code and recompile OH2 yourself. If your a programmer, simply look for the ProxyServlet in eclipse and make the modification I described above (code is pretty easy to understand). If your not, not sure it would be worth the effort. Since I posted that, I’ve found out (over on the eclipse smart home forum) that there is an UI Image item that can take a raw image data and display the image (unfortunately only supported in the PaperUI for now). That seemed to work great and solve the issue I was having…

Tim

I have submitted a pull request to allow Image item=StringItem and Video item=StringItem

I’ve tested on both Classic and Basic UIs.

It is still under discussion, most of the discussion being here: