OpenEPaperLink / Home_Assistant_Integration

Home assistant Integration for the OpenEPaperLink project
https://openepaperlink.de
Apache License 2.0
149 stars 34 forks source link

dlimg should support local images in /media #88

Closed bearylogical closed 9 months ago

bearylogical commented 9 months ago

Is your feature request related to a problem? Please describe. The dlimg feature seems to support images from a remote URL. There can be instances where one has a static image to draw alongside some dynamic text.

Describe the solution you'd like A flag in the configuration or an update to support a local images (images stored in the /media folder) similar to dlimg

Describe alternatives you've considered The requests library in the dlimg does not support this behaviour, so a modification (new feature) is necessary

chunkysteveo commented 9 months ago

You can add images to the /www/ folder and link to them via dlimg - do you know that? You can then reference it like url: https://YOUR_HA_HOSTNAME_OR_IP/local/chuck-icon.jpg in the code.

I do however like the idea of local references to files, much like the font path is referenced etc, and keeping them in media, and not "public" via /www folder. IF YOU HAVE YOUR HA INSTANCE AVAILABLE VIA NABU, REVERSE PROXY, DDNS, ETC - THE IMAGE WILL BE VISIBLE ON THE INTERNET AND DOES NOT REQUIRE A USER TO BE LOGGED IN.

bearylogical commented 9 months ago

Hey @chunkysteveo, yeah thats a good tip. The part about having the images visible on the internet is a valid point on why this local functionality should be explored :)

chunkysteveo commented 9 months ago

Hey @chunkysteveo, yeah thats a good tip. The part about having the images visible on the internet is a valid point on why this local functionality should be explored :)

Agreed - didn't realise it would be public-PUBLIC till I tested it as I wrote my reply(!!) I have an icon or two so it's not the end of the world for me - but could be bad if you used it to store sensitive data based images.

jonasniesner commented 9 months ago

Implemented in dc53e85

chunkysteveo commented 9 months ago

How does dlimg work for local image @jonasniesner ? Tested it, and it can't find the image in /media/ folder (where we also store the font files etc)? I've tried all sorts of paths and quotes/no-quotes for url: "../../media/chuck-icon.jpg" but with no luck?

[Errno 2] No such file or directory: '../../media/chuck-icon.jpg'

jonasniesner commented 9 months ago

try /media/... Or /config/www/media/...

chunkysteveo commented 9 months ago

/config/media/chuck-icon.jpg did the trick....