Mehdi Semlali Mehdi Semlali - 6 months ago 26
HTML Question

Display a photo in website (LAMP) from a distant server without HTTP

I have a website hosted in LAMP Server.
My Lamp server is installed in a Debian virtual machine.
My virtual machine is hosted in a distant server.

I face a problem when i try to display an image in my website from the distant server. this is an example of the code i am using :


When i try this code, nothing is displyed.

I need your help.

Thank you


If I really understand your question, you have a linux webserver and you want to embed an image from your server inside a HTML file.

When you wrote src="\NameOfDistantServer\Directory\MyImage.jpg", you should add slashes instead of backslashes even if most browsers changes them correctly.

Asyour question is a bit unclear, I will show you most used methods of embedding images on a webpage.

1. Specify full URL of the image:

If you want to specify full url, your code should be like this:

<img src="http://yourdomainname.something/directory/yourimage.jpg"/>

2. Specify a relative URL of the image:

If your image is hosted for example, at:, and you want to print that image still on the same domain (, you can specify the relative path of the image, not the entire path:

<img src="/directory/test.png"/>

3. Encode images to base64 to not use files

If you don't want to host the image inside a file on your server, you can covert it to base64 and embed it on your webpage as a code, instead of file url. For this, you can use our service which is converting the image you choose to an encoded image: