Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By matkar
#21668 Hi, thank you very much for the example!
It works great except for the image page. When I try to load 192.168.4.1/showled or 192.168.4.1/led.png the page responds it can't display the picture because it contains errors. I've tried to load the page with Firefox and Chrome...
I've compiled the example with a different png picture as well but to no avail.
Anybody else has the same problem?

Regards,
Mat
User avatar
By tommybee
#22854 Same to me, the Picture don't show up !!!
This part of code don't work!!

void handle_image() {
server.send(200, "image/png", ""); //nothing is transmitted, that's ok here cause of the ,"");
WiFiClient client = server.client();
client.write(image, sizeof(image)); //also nothing is transmitted, that's not ok here !!!!!!
}

I'm on Version 1.6.4-673-g8cd3697
:?: :?: :?: :?: :?: :?:
User avatar
By matkar
#23635 To correct the missing images substitute function:
void handle_image() with
Code: Select allvoid handle_image() {
  WiFiClient client = server.client();
  client.write(image, sizeof(image));
  server.send(200, "image/png", "");
}


I was searching for an application that would transform png images to the necessary byte array. Unfortunately I couldn't find any. If anybody knows where to get one, please let us know.

For smaller pictures the parsing can be done manually with the help of some tools. I used http://www.fileformat.info/tool/hexdump.htm online service to convert my PNG to hex. I copied the result to libreoffice writer where I removed the unnecessary portions (columns) and added "0x" columns and commas to the array. This way it takes only a few minutes for a small picture to adapt it to the correct format.

Regards,
Mat
User avatar
By martinayotte
#23648
matkar wrote:I was searching for an application that would transform png images to the necessary byte array. Unfortunately I couldn't find any. If anybody knows where to get one, please let us know.


There is Hexy : https://github.com/tristan2468/Hexy/

But, unfortunately, the Linux binary isn't there any more.