diff --git a/esp32cam-demo.ino b/esp32cam-demo.ino index 923d27f..0ce38ce 100644 --- a/esp32cam-demo.ino +++ b/esp32cam-demo.ino @@ -893,7 +893,7 @@ bool handleImg() { int imgToShow = imageCounter; // default to showing most recent file // get image number from url parameter - if (server.hasArg("img")) { + if (server.hasArg("img") && sdcardPresent) { String Tvalue = server.arg("img"); // read value imgToShow = Tvalue.toInt(); // convert string to int if (imgToShow < 1 || imgToShow > imageCounter) imgToShow = imageCounter; // validate image number @@ -912,20 +912,33 @@ bool handleImg() { pRes = 1; // flag sucess } else { if (serialDebug) Serial.println("Error: image file not found"); - WiFiClient client = server.client(); // open link with client - client.write("
\n"); + sendHeader(client, "Display stored image"); client.write("Error: Image not found
\n"); - delay(3); - client.stop(); + client.write("