Displaying Raw Image in Habpanel

image
habpanel
customwidget
Tags: #<Tag:0x00007f212a5fc470> #<Tag:0x00007f212a5fc308> #<Tag:0x00007f212a5fc1c8>

(jay kay) #1

Hi there,
I am trying to get HABPanel to display a raw image item (cover channel from squeezebox binding)
I created a custom widget but the image is not being displayed.
After investigating, I found out, that an “unsafe:” string is added before the URL.
Googling for this leads me to answers that suggest manupulations to the DomSanitizer.
But I have no idea how to do that in one of those custom widgets.
My attempts to just open a item and adding the functionality there have not been successful.
Any help?


(Yannick Schaus) #2

If you have an Image item, the built-in Image widget has support for it.

image

The trick to include one in a custom widget is documented here:

In your case that would be something like:

<div ng-init="imagemodel = { 'image_source': 'item-image', 'item': 'TestImage' }">
   <widget-image ng-model="imagemodel"></widget-image>
</div>

You might need some additional CSS to display it the way you want it.


(jay kay) #3

Hi Yannick!
Thank you very much for your answer.
It turns out that this feature was not present in openhab 2.1 so I had to do a very painful migration but now the feature is present in HabPanel.
I can now select an image item.
BUT: Sadly it does not work.
The same image item works in the sitemap but not in habpanel.
I have simply selected the image item in the configuration but the resulting html still has the “unsafe:” tag in front of the actual data.
This is very depressing.
What am I doing wrong?


(Christian) #4

I also have that problem (Squeezebox Cover item with image widget). Maybe there’s something wrong with the Squeezebox binding?


(Mark) #5

There was a recent PR to fix the cover art. Unless you are on a recent snapshot, it may not work for you.


(jay kay) #6

@mhilbush I installed 2.2 snapshot last night, and it doesn’t work.


(jay kay) #7

@baeron52
It would surprise me, if this were a bug in the sqzeezebox plugin.
From what I have recently learned, I think the problem is that the Angularjs safety mechanism that prevents XSS attacks is blocking the image content. And the reason it is doing this (and this is a wild, speculative guess on my side) is, that the content type of the image is not whitelisted in the imgSrcSanitizationWhitelist for the compileProvider.
And the reason it is not whitelistet might be, that the content type for the image from the squeezebox binding is “application:octet-stream” and not some image type.
So perhaps this type was not whitelisted in the HabPanel configuration.

But again: wild guesses.
@ysc what do you think?


(Yannick Schaus) #8

That’s probably your problem right there.

I tried updating an Image item manually with the openHAB console like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gV20uCGhsA19tLghtpcEXSNgGvtpcENtLghobANfbS4IbeXBDQ2CDBtpcENtLghoZyTX20uCG2lwQ0Ngm5rbaXBDbS4IaGymSau3lwRO3lwRNK2bEJWNfrE+CHWJ8IjVGz4mbC/v17Gh1ifBF6eMqUpayjBv1RLjVxsldxO4ZyPqlfyU+T+SfqlfyU+T+Tl48nq82DrMk5H1Sv5KfJ/I+qV/JT5P5HiyXzYOuVRyfqlfy0+T+SfqlfyU+T+R48jzYOsLHI+qV/LT5P5H1Sv5afJ/I8eSebF1mMzk/U63kp8n8j6pX8tPk/kePI82LqZ3JOV9TreWnyfyPqdbyU+T+S+PJny4uqsy245H1Ov5afJ/I+qV/LT5P5HjyXzYuuQrnJWlK6+ynyfyHpOs/tp8n8jx5HlxdZq4zsclaTrL7afJ/I+qV/LT5P5HjyTy4usg3ZHJ+qV/JT5P5H1Ot5afJ/I8eR5cXUu7h5M5f1Ot5afJ/JH1Kt5afJ/JfHTy4urchpbzmfU63lp8n8kfUq3lp8n8jsyTy4tMAHd5gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//2Q=="

(note that has an image/jpeg media type)

openhab> smarthome:status TestImage
raw type (image/jpeg): 8641 bytes

The HABPanel widget displays the image without problems.

If I try again with an application/octet-stream media type, it adds the unsafe: prefix indeed. I also have a ‘Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME’ error in the Console. Which is to be expected I think – data URIs should always have their actual media types properly set (even if the browser might be able to figure it out by looking at the content). This looks like a problem with the binding.


(jay kay) #9

@ysc thanks for confirming. I will open an issue for the binding.


(Mark) #10

I think this might be a problem with the Squeezebox Server (i.e. Logitech Media Server). The coverart image is served directly by the LMS web server, not by the binding.


(Yannick Schaus) #11

Right, but the data is downloaded by the binding and exposed in a channel as a RawType.

This might be the culprit:

There is a constructor for RawType allowing to specify a mime type, if not it’ll fallback to application/octet-stream:


(Yannick Schaus) #12

Digging further on this, the HttpUtil class has downloadImage methods to retrieve an image directly wrapped in a RawType with the proper mime type by using some heuristics to guess it (if I understood correctly).
The binding should use that instead of downloadData and constructing a RawType itself.


(Bogumil J.) #13

Does it mean that this is an issue with the binding only? Is there any plan to fix it? Cheers.