Jump to content

<img src="E:\My Documents\My Pictures\IMG_1575.JPG" width="300" height="200" /> not working.


jane

Recommended Posts

The image file IMG_1575.jpg is shown properly if I include it using <img src="IMG_1575.jpg" width="300 height="200" />. But if I include it with <img src="E:\My Documents\My Pictures\IMG_1575.JPG" width="300" height="200" />, the image is not shown in the browser. It's blank. How to resolve this? How to include a file on my local computer with direct path?Any input is GREATLY appreciated.

Link to comment
Share on other sites

If this is going to be part of a public page, then this is not possible. You must upload the image to your directory to let others be able to view it.Else, if the page is only for you privatly, then put a "protocol" in front:<img src="file:///E:\My Documents\My Pictures\IMG_1575.JPG" width="300" height="200" />

Link to comment
Share on other sites

One problem that I have come across is when adding a path to somewhere if you use \ it will only show the picture in IE, you made need to replace them with / that might make it work?It is apparently a bug in IE which lets you use \'s but if you check you code on the vaildater Here it will tell you to replace them I think.

Link to comment
Share on other sites

Thank you very much for all the above replies. Now, I used the <img src="file:///E:/My Documents/My Pictures/2006_04_21/IMG_1575.JPG" width="300" height="200" />the picture is still not shown.The page is not online, it's only on my local computer.

Link to comment
Share on other sites

Thank you very much.With file:\\\ or without still cannot make the image show up on the browser. I checked on both firefox 1.5.0.6 broswer and IE 7.0.5450.4. Usually I only use firefox since it's faster.

Link to comment
Share on other sites

Oh, but that is virtually the same as online. You don't open it from your computer, but still from the internet by using "localhost". It is a virtual server, on your machine privatly. But it still is internet, though only for you. If you open the file just by clicking the .html file, then it would work. Try it :)The way you do it is the same as online even it only counts for your machine only. To open a file from your machine is meant from the file access and not via an URL :) Correct it by "uploading" the file to the directory on your machine that is under your virtual host.

Link to comment
Share on other sites

Try changing the spaces in the filename to %20. <img src="file:///E:/My%20Documents...
I thought about that, but it doesn't matter, with spaces it also worked in my browser (IE) :) Don't know in others, but still. It is just the fact that this document was, in the eyes of the machine, to be found on internet instead of the machine itself. And then it is not allowed to access the harddrive(s) :)
Link to comment
Share on other sites

The %20 does not work. Yes. If I put the image file to the same directory as my html file under my virtual host, the image is shown properly. Now I am clear!!! When I opened the html file through open->file->browse, I can see the image even if it's just <img src="E:\directory\file.html">. That's why I always saw the picture when I first learned html. Then I began to learn php. I installed php, apache, mysql on my machine. Today, I wanted to incorporate my previous html file with php to make it more dynamic. But this time, I opened the file through http:\\localhost\file.html, but I could not see the image.So when I opened the http:\\localhost\file.html, I actually accessed it through online, although only I can access the file. So in this way, I cannot use <img src="E:\directory\file.html">. Instead, I should upload the file to the directory under my virtual host.Thank you so much for your help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...