Go Down

Topic: Problem to show an image on website (Read 1 time) previous topic - next topic


Hi ,
I've a little problem , i need to show an image on website from SDcard but i didn't get it works .
I've an arduino UNO ethernet

sample code :

// envoi d'une entete standard de réponse http
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          // envoie les chaines de caractères voulues = du code HTML
            //---- debut de la page HTML(begin of page) ---
             // ---- Entete de la page HTML( header of page) ----
             client.println("<meta content=\"text/html; charset=ISO-8859-1\" http-equiv=\"Content-Type\">");
             client.println("<title>Connexion au Serveur Arduino</title>");
             // balise meta pour réactualisation automatique de la page Web toutes les n secondes ( refresh of page )
             client.println("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"5\">");
             //----- Corps de la page HTML ( body of page )---
             client.println("<font color=");
             client.print(byte(34)),client.print(">") ; 
             if (strstr("image.jpg", ".jpg") != 0){   //
               client.println("Content-Type: image/jpeg");
             client.print("<img src="),client.print(byte(34));
             client.print("logo_edf.jpg");                                // image display
             client.print(byte(34)),client.print(">") ; 
             client.println("<br />");
       theFile.close(); // close       
             client.println("</html>");//---- fin de la page HTML(end of pages)
Sorry for my english ^^' and i accept all help thank you :)


Instead of writing the text "client.print("logo_edf.jpg")", you have to get the file from the SD card.
So you have to use SD.begin, SD.open, File.read and so on.

There are good examples for that, you could start here : http://www.ladyada.net/learn/arduino/ethfiles.html

Go Up