# Web Server. Load image?

**URL:** <https://discourse.processing.org/t/web-server-load-image/20356>\
**Category:** Libraries\
**Created:** [May 1, 2020, 4:39pm UTC](https://discourse.processing.org/t/web-server-load-image/20356 "2020-05-01T16:39:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Omnimusha](https://avatars.discourse-cdn.com/v4/letter/o/b77776/32.png) [@Omnimusha](https://discourse.processing.org/u/Omnimusha)\
**Post date:** [May 1, 2020, 4:39pm UTC](https://discourse.processing.org/t/web-server-load-image/20356/1 "2020-05-01T16:39:49Z")

</div>

Hi.  
how to upload an image from my pc?

```auto
c.write("<img src=1.jpg>");

```

```auto
import processing.net.*;
String HTTP_GET_REQUEST = "GET /";
String HTTP_HEADER = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n";

Server s;
Client c;
String input;
PImage img; // Declare variable "a" of type PImage

void setup() 
{
  s = new Server(this, 8080,"192.168.1.9"); // start server on http-alt
  
  img = loadImage("1.jpg"); // Load the image into the program  

  
}

void draw() 
{ image(img, 0, 0);

  
  // Receive data from client
  c = s.available();
  if (c != null) {
    input = c.readString();
    input = input.substring(0, input.indexOf("\n")); // Only up to the newline
    
    if (input.indexOf(HTTP_GET_REQUEST) == 0) // starts with ...
    {
    c.write(HTTP_HEADER); // answer that we're ok with the request and are gonna send html
    
    // some html
    c.write("<html><head><title>Processing talkin'</title></head><body><h3>Your base are belong to us!");
	
        c.write("<img src=1.jpg>");

    
    c.write("</h3></body></html>");
    
    // close connection to client, otherwise it's gonna wait forever
    c.stop();
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Omnimusha](https://avatars.discourse-cdn.com/v4/letter/o/b77776/32.png) [@Omnimusha](https://discourse.processing.org/u/Omnimusha)\
**Post date:** [May 12, 2020, 2:25am UTC](https://discourse.processing.org/t/web-server-load-image/20356/2 "2020-05-12T02:25:10Z")

</div>

?? Hi…need help lol

---

<div class="post-metadata">

**Author:** ![tboydar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tboydar/32/14868_2.png) [@tboydar](https://discourse.processing.org/u/tboydar)\
**Post date:** [October 31, 2021, 9:40am UTC](https://discourse.processing.org/t/web-server-load-image/20356/3 "2021-10-31T09:40:35Z")

</div>

make image to base 64 in the reply or upload to a site use that link

ref:  
[https://stackoverflow.com/questions/8499633/how-to-display-base64-images-in-htmlhttps://forum.processing.org/one/topic/how-to-load-an-image-in-base64-with-processing-js.html](https://stackoverflow.com/questions/8499633/how-to-display-base64-images-in-htmlhttps://forum.processing.org/one/topic/how-to-load-an-image-in-base64-with-processing-js.html)
