First, you need to add the images to your HTM-File using the standard img-tag. This tells the client to send a valid HTTP-Request to your server for each image. Then your server needs to regonise the request, read the image from the SD-Card and send it back to the client.
Here's a hint how to do this (assuming you are using PNG-Images)
if (StrContains(HTTP_req, "ajax_inputs")) {
// send rest of HTTP header
client.println("Content-Type: text/xml");
client.println("Connection: keep-alive");
client.println();
SetLEDs();
// send XML file containing input states
XML_response(client);
}
else if (StrContains(HTTP_req, "png")) {
// send rest of HTTP header
client.println("Content-Type: image/png");
client.println("Connection: keep-alive");
client.println();
// Parse the filename of the image from the HTTP Request
// Open the file from the SD-Card and send it to the client (same as with HTM-Files)
}
else { // web page request
// send rest of HTTP header
client.println("Content-Type: text/html");
client.println("Connection: keep-alive");
client.println();
// send web page
webFile = SD.open("index.htm"); // open web page file
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
}
riesens:
First, you need to add the images to your HTM-File using the standard img-tag. This tells the client to send a valid HTTP-Request to your server for each image. Then your server needs to regonise the request, read the image from the SD-Card and send it back to the client.
Here's a hint how to do this (assuming you are using PNG-Images)
if (StrContains(HTTP_req, "ajax_inputs")) {
// send rest of HTTP header
client.println("Content-Type: text/xml");
client.println("Connection: keep-alive");
client.println();
SetLEDs();
// send XML file containing input states
XML_response(client);
}
else if (StrContains(HTTP_req, "png")) {
// send rest of HTTP header
client.println("Content-Type: image/png");
client.println("Connection: keep-alive");
client.println();
// Parse the filename of the image from the HTTP Request
// Open the file from the SD-Card and send it to the client (same as with HTM-Files)
}
else { // web page request
// send rest of HTTP header
client.println("Content-Type: text/html");
client.println("Connection: keep-alive");
client.println();
// send web page
webFile = SD.open("index.htm"); // open web page file
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
}
Hey riesens!
It worked!!
Thanks for always helping me out on all my problems, I really appreciate it cause u have always tried to help on every topic i have posted
riesens:
First, you need to add the images to your HTM-File using the standard img-tag. This tells the client to send a valid HTTP-Request to your server for each image. Then your server needs to regonise the request, read the image from the SD-Card and send it back to the client.
Here's a hint how to do this (assuming you are using PNG-Images)
if (StrContains(HTTP_req, "ajax_inputs")) {
// send rest of HTTP header
client.println("Content-Type: text/xml");
client.println("Connection: keep-alive");
client.println();
SetLEDs();
// send XML file containing input states
XML_response(client);
}
else if (StrContains(HTTP_req, "png")) {
// send rest of HTTP header
client.println("Content-Type: image/png");
client.println("Connection: keep-alive");
client.println();
// Parse the filename of the image from the HTTP Request
// Open the file from the SD-Card and send it to the client (same as with HTM-Files)
}
else { // web page request
// send rest of HTTP header
client.println("Content-Type: text/html");
client.println("Connection: keep-alive");
client.println();
// send web page
webFile = SD.open("index.htm"); // open web page file
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
}
[/quote
> riesens:
> First, you need to add the images to your HTM-File using the standard img-tag. This tells the client to send a valid HTTP-Request to your server for each image. Then your server needs to regonise the request, read the image from the SD-Card and send it back to the client.
>
> Here's a hint how to do this (assuming you are using PNG-Images)
>
>
>
> ```
> if (StrContains(HTTP_req, "ajax_inputs")) {
// send rest of HTTP header
client.println("Content-Type: text/xml");
client.println("Connection: keep-alive");
client.println();
SetLEDs();
// send XML file containing input states
XML_response(client);
}
else if (StrContains(HTTP_req, "png")) {
// send rest of HTTP header
client.println("Content-Type: image/png");
client.println("Connection: keep-alive");
client.println();
// Parse the filename of the image from the HTTP Request
// Open the file from the SD-Card and send it to the client (same as with HTM-Files)
}
else { // web page request
// send rest of HTTP header
client.println("Content-Type: text/html");
client.println("Connection: keep-alive");
client.println();
// send web page
webFile = SD.open("index.htm"); // open web page file
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
}
Hey riesens!
The image shows but it does not toggle the state of the outputs, when i switch back to normal buttons it works again
riesens:
First, you need to add the images to your HTM-File using the standard img-tag. This tells the client to send a valid HTTP-Request to your server for each image. Then your server needs to regonise the request, read the image from the SD-Card and send it back to the client.
Here's a hint how to do this (assuming you are using PNG-Images)
if (StrContains(HTTP_req, "ajax_inputs")) {
// send rest of HTTP header
client.println("Content-Type: text/xml");
client.println("Connection: keep-alive");
client.println();
SetLEDs();
// send XML file containing input states
XML_response(client);
}
else if (StrContains(HTTP_req, "png")) {
// send rest of HTTP header
client.println("Content-Type: image/png");
client.println("Connection: keep-alive");
client.println();
// Parse the filename of the image from the HTTP Request
// Open the file from the SD-Card and send it to the client (same as with HTM-Files)
}
else { // web page request
// send rest of HTTP header
client.println("Content-Type: text/html");
client.println("Connection: keep-alive");
client.println();
// send web page
webFile = SD.open("index.htm"); // open web page file
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
}
Hey riesens!
The image shows but it does not toggle the state of the outputs, when i switch back to normal buttons it works again