jane Posted August 24, 2006 Share Posted August 24, 2006 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 More sharing options...
Jack McKalling Posted August 24, 2006 Share Posted August 24, 2006 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 More sharing options...
Cronthenoob Posted August 24, 2006 Share Posted August 24, 2006 Is the page with your <img> tag online? or is it also on your local computer? Link to comment Share on other sites More sharing options...
holmedwa04 Posted August 24, 2006 Share Posted August 24, 2006 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 More sharing options...
jane Posted August 24, 2006 Author Share Posted August 24, 2006 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 More sharing options...
Cronthenoob Posted August 24, 2006 Share Posted August 24, 2006 If its just locally, try it without the file:/// . . . . Link to comment Share on other sites More sharing options...
Jack McKalling Posted August 24, 2006 Share Posted August 24, 2006 I think you should search for the problem elseways because this file:/// did work for me. Maybe is it the browser you are using? Link to comment Share on other sites More sharing options...
jane Posted August 24, 2006 Author Share Posted August 24, 2006 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 More sharing options...
Jack McKalling Posted August 24, 2006 Share Posted August 24, 2006 Then use only slashes: /file:///E:/something/something/something/something.jpgAlso: you do open this local file from your computer and not from an online page (like with a link), don't you? Link to comment Share on other sites More sharing options...
jane Posted August 24, 2006 Author Share Posted August 24, 2006 Thanks. I tried your suggestion, still no image shown. Yes, I open the file from my computer http://localhost/file.html Link to comment Share on other sites More sharing options...
Jack McKalling Posted August 24, 2006 Share Posted August 24, 2006 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 More sharing options...
justsomeguy Posted August 24, 2006 Share Posted August 24, 2006 Try changing the spaces in the filename to %20. <img src="file:///E:/My%20Documents...You can always just go to File -> Open, open the image, and see what the address is. Link to comment Share on other sites More sharing options...
Jack McKalling Posted August 24, 2006 Share Posted August 24, 2006 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 More sharing options...
jane Posted August 24, 2006 Author Share Posted August 24, 2006 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 More sharing options...
Jack McKalling Posted August 25, 2006 Share Posted August 25, 2006 You're very welcome Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now