Pages: [1]   Go Down
Author Topic: Problem to show an image on website  (Read 683 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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");
          client.println();
          // envoie les chaines de caractères voulues = du code HTML
            //---- debut de la page HTML(begin of page) ---
             client.println("<html>");
             // ---- Entete de la page HTML( header of page) ----
             client.println("<head>");
             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\">");
             client.println("</head>");
             //----- Corps de la page HTML ( body of page )---
             client.println("<body>");
             client.println("<h1>");
             client.println("<center>");
             client.println("<font color=");
             client.println("#FF0000");
             client.print(byte(34)),client.print(">") ; 
             client.println("Title");
             client.println("</font>");
             client.println("</center>");
             client.println("</h1>");
             client.println("<br>");
             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("</body>");           
             client.println("</html>");//---- fin de la page HTML(end of pages)
Sorry for my english ^^' and i accept all help thank you smiley

Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: