A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By kentbkiwi
#67032 Is it possible to send an embedded image from an ESP8266 set up as a webserver (using a WeMos D1 mini)? If so, are there any limits. I would like to have a background image which is stored in flash.
User avatar
By GengusKahn
#67150 Hi there, just use "server.streamfFle".....

Pass the path to the file and descriptor to server.streamFile, in the sketch / html just use message += "<body background=\"/eye.gif\">";

Code: Select all
//Use this to send an Image or File from SPIFFS
void loadImg(String path, String TyPe)
{ // path=Filename(including root "/"), TyPe= html descriptor
 if(SPIFFS.exists(path)){
    File file = SPIFFS.open(path, "r");
    server.streamFile(file, TyPe);
    file.close();
  }
}
in setup
//  Any Images need to be uploaded to SPIFFS...!!!
  server.on("/eye.gif", []() { loadImg("/flame.gif", "image/gif"); } );  // or jpg
User avatar
By flagtrax
#73276 Hi @GengusKahn, after looking at some of the information on the stream class here
https://www.arduino.cc/reference/en/language/functions/communication/stream/
I simply got confused. My experience is limited, I was wondering if you could elaborate on your example a bit. Or perhaps point me to some examples. I am very much interested in understanding this particular action using the 8266. Can this process be incorporated into say an HTML button object or other uses? That is one of my goals. Thanks and much obliged for any steering..