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
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
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.
Related
I tried to use Google Doc Embedder by using this code
[gview file="http://localhost/wordpress/wp-content/uploads/2013/07/list.pdf"]
but this error keeps on showing up..
Sorry, we were unable to find the document at the original source. Verify that the document still exists.
You can also try to download the original document by clicking here.
I checked in the directory/path to verify and its still there. So what is the reason that this error keeps on showing up?
Google Docs doesn't have access to your local machine. It will need to be on publicly accessible web server for that to work.
Your file path is wrong. You are pointing to localhost for your server. This is something running on your machine only so google reader would not be able to point to a file on your machine.
You should upload your file to a public server.
You can try even
<iframe src="http://localhost:8080/pdf">
I think there are plugins for iframe in wordpress ,Try it out..
In my Wordpress I use this plugin for Google Docs to embed .pdf
DirtySuds - Embed PDF
Then in the post use this:
[embed width="620" height="600"]http://site.com/file.pdf[/embed]
edit:
You will need live host to upload your .pdf files there.
I'm building graphs using pChart in PHP. The case is that I have my picture in the right folder, I know it because if I put that path in the browser I can see my picture, but in the template, it doesn't show up. Firebug shows "failed to load the given URI".
<img src="/home/user1/mysite/Admin/Template/mx_graphs/example13.png">
The picture has all the rw permissions given, and the folder.
You appear to be using a UNIX file path instead of a relative URI. Your web server is unlikely to be configured to have the DocumentRoot be / (and it would be very silly to do so).
Construct a URI relative either to the HTML document or to the DocumentRoot of your server.
The latter will probably be /Admin/Template/mx_graphs/example13.png
Remember the statement:
<img src="/home/user1/mysite/Admin/Template/mx_graphs/example13.png">
Will run on the client side, so if you run this on the very computer where the picture is stored, it should work fine, but if you try to open it from another computer it will not work.
Try to use relative path (http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/), and try to keep the website resources into the website root folder, so that even when you host the site the image be copied over and will still be accessible..
I'm having trouble with missing images on my server.
I have been developing a site locally using MAMP for a while and now that I have uploaded it to my server the images cannot be found. Firebug tells me "Failed to load the given URL".
The file structure is the exact same as it was locally and the code is also the same.
The php file trying to load the images is in the site's root folder along with the folder "images".
Here is the file structure: images/models/dreadfinsl1.jpg
Here is the page: http://eoghanoloughlin.net/george/index.php
Can anyone help me? It seems like it would be just one of those stupid problems / simple answers but I'm relatively new to this don't have much experience. It was working fine when I was using MAMP.
Looks like your in the /george/ map on the server, and i assume locally u used www/
try /george/images/models/dreadfinsl1.jpg
else you will have to use full path http://eoghanoloughlin.net/george/images/models/dreadfinsl1.jpg
Try to access an image which is in your server with the help of web browser by specifying absolute path of the image....
Like http://eoghanoloughlin.net/images/models/dreadfinsl1.jpg
If you found any image on the browser, try to display the same image on your index page...
I think specifying the file path is being a problem in your application....
I have developed a website to upload and display images. And it works fine on the local server , but when I upload it to the web server it wont show the image. But the file has been uploaded to the current location in the server and the path is also fine.
I'd suggest you the full path in the url, literally type it out.
If that does not work, check that the file is readable by setting the permissions of the image file.
I think you may have problem with their format. Check your scripts and make sure their formats to be as same as your local files. If you have a programming mistake, files will save on the server, but their formats may not be actual.
I had this problem before ...
I made a class that converts a string of text into a png image and uploads on the server:
http://testing.mehhh.org/php/png.php (you can view php source on the page)
http://testing.mehhh.org/php/phg.php <-- shows php version
this one works great.
now I am trying to get this to work on a clients server
http://autoxplorer.com/~tameem/png.php This doesn't work!
http://autoxplorer.com/~tameem/php.php <-- also using same php version
what gives? I thought it's a permission thing.. but the png folder has full access.. and I tried a super simple uploading script and it runs and saves files to that folder. What is going on here?
You have just put online some PHP scripts that link to images. The link to the images actually is different.
http://testing.mehhh.org/php/png/4de9441d68cf8_1307132957.png
http://autoxplorer.com/~tameem/png/4de9424d41208_1307132493.png
While the first link returns actually an image, the second image link gives a 404 error. Looks like you have not configured your server properly to actually execute the PHP in the second case to return an image.