在没有HTTP的远程服务器上显示网站(LAMP)中的照片

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 :

src="\\NameOfDistantServer\Directory\MyImage.jpg"

When i try this code, nothing is displyed.

I need your help.

Thank you

The only way i found to resolve my problem was to do mount command :

mout -t cifs /serverDistant/directoryToshare /directory username pwd

After this command i can display all the image like if it was on local directory. Thank you all for your suggestions, i really appreciate your help.

I'm pretty sure it should be something like:

src="http://NameOfDistantServer/Directory/MyImage.jpg"

You need to specify the http, otherwise the browser thinks the file is on the same server as the html page. You need the / slashes because that's what most web servers understand.

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: http://example.com/directory/test.png, and you want to print that image still on the same domain (example.com), 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: http://netcreator.us/base64-image-encode