-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help displaying an image from file #318
Comments
In fact, this might be a file problem more than an image one because this also doesn't work for me:
But what I get on the webpage, in the file text box is
|
Well.... i am displaying images sucessfully but it seems like a hack - i set up another asyncwebserver on port 81 and set the image URL in the label to http://myhostname.local:81/imagename My second webserver just reads images from littleFS and makes them available on port 81. Have i missed something obvious and there is a way to just call a littleFS file from the ESPUI label? |
I am using the following code to display the image on the label component: Image file located in: /app/re_logo.png on the LittleFS.
and then:
|
Could you explain how that works please? My understanding is that the newly defined "server" will point to the same instance of the aynscwebserver object that is made by ESPUI....and then we are saying for requests to "/" to juse server the called image file. This doesn't screw up ESPUI internally? Thanks I will try this way in the meantime. |
Yes, exactly. The 'server' pointer will point to the instance of the AsyncWebServer created inside the ESPUI. Then you can attach other handlers to it, like i.e. 'servestatic'. Nothing will break. |
Just a note: By convention, the "/" endpoint should return an index.html file or nothing at all. You can add any other endpoints you like below that. |
This lib is great, I am only one day in and I have webpages with controls and all sorts showing up where before I was following a lot of tutorials dealing with raw HTML assembling and getting frustrated, fast..... but I feel like I must be missing something with ESPUI and images.
It seems the way to display an image is in a tag, per the docs.
That's OK for images already accessible by http, but the images I want to display are in LittleFS.
I found #143 which seems to build up a string from a buffer - I don't completely understand if I need to do something like that, streaming the file from LittelFS with file.open and so on, or if - and this is what I hope is true - I missed something and it's built in, and I can just specify an existing file from LittleFS.
Help appreciated :-)
The text was updated successfully, but these errors were encountered: