tibi Posted September 19, 2011 Share Posted September 19, 2011 Hi could somebody help me ? The picture does not show in the web page I used the following syntax: <img src="C:\Documents and Settings\Tnagy\Desktop\Foto Chips\DSC_0127.jpg" alt="think is a picture"/> Where is the mistake as the path should be correct I copy it and paste it from the address bar plus I add the DSC_0127.jpg. Thank you Link to comment Share on other sites More sharing options...
thescientist Posted September 19, 2011 Share Posted September 19, 2011 Hi could somebody help me ? The picture does not show in the web page I used the following syntax: <img src="C:\Documents and Settings\Tnagy\Desktop\Foto Chips\DSC_0127.jpg" alt="think is a picture"/> Where is the mistake as the path should be correct I copy it and paste it from the address bar plus I add the DSC_0127.jpg. Thank you i think it would be better if you started your own thread. however, are you trying to view this webpage from your computer or online? What you have posted is an example of an absolute link, and will work only from within the context of your local machine. Ideally all your project files (html, css, images, etc) should all be within a single folder, and your links should be relative to that. a common practice is to create an images folder within the root project folder and your links would typically look something likeimages/filename.jpg also, you should get in the habit of using underscores or camel casing for file/folder names. Link to comment Share on other sites More sharing options...
tibi Posted September 19, 2011 Author Share Posted September 19, 2011 To thescientist you were right I should start my own thread but how i do that, as this is first time I use a forum. Link to comment Share on other sites More sharing options...
thescientist Posted September 19, 2011 Share Posted September 19, 2011 go to the sub-forum you want to post in (HTML/CSS/etc) and click "start new topic" at the top-right of the page. Link to comment Share on other sites More sharing options...
tibi Posted September 19, 2011 Author Share Posted September 19, 2011 Hi there, I have here two syntax nr.1 is with a picture from my computer and nr.2 is from W3Schools.com web site.Both I taped them in Notepad for a test web page as I try to learn HTML.But only the second one shows in my test web page, why is that? 1 <img src="C:\Documents and Settings\Tnagy\Desktop\Picture_Chips\DSC_0119.JPG" alt="think is a picture"/> 2 <img src="http://www.w3schools.com/images/w3schools_green.jpg" alt="W3Schools.com" width="104" height="142" /> Link to comment Share on other sites More sharing options...
Ingolme Posted September 19, 2011 Share Posted September 19, 2011 To link to files on your computer you have to use the file:// protocol. <img src="file:///C:\Documents and Settings\Tnagy\Desktop\Picture_Chips\DSC_0119.JPG" alt="think is a picture"/> It has three slashes: the first two from the URL syntax and the third refers to the root of the system. Links to local files will only work for a page that's on your computer. (This excludes localhost) Link to comment Share on other sites More sharing options...
tibi Posted September 19, 2011 Author Share Posted September 19, 2011 I tried as u said but doesn't work,the page is on my computer. Thank you for your response anyway Link to comment Share on other sites More sharing options...
dsonesuk Posted September 20, 2011 Share Posted September 20, 2011 try it with slashes facing in the same direction <img src="file:///C:/Documents and Settings/Tnagy/Desktop/Picture_Chips/DSC_0119.JPG" alt="think is a picture"/>or<img src="file:///C|/Documents and Settings/Tnagy/Desktop/Picture_Chips/DSC_0119.JPG" alt="think is a picture"/> Link to comment Share on other sites More sharing options...
tibi Posted September 20, 2011 Author Share Posted September 20, 2011 I tried the other way and still doesn't work I don't know why? Link to comment Share on other sites More sharing options...
Ingolme Posted September 20, 2011 Share Posted September 20, 2011 Is this page running from your filesystem? Link to comment Share on other sites More sharing options...
tibi Posted September 21, 2011 Author Share Posted September 21, 2011 Yes, and I put even the picture in the same file where the web page is changing the path in the syntax ,and I still have a broken link instead of picture. Link to comment Share on other sites More sharing options...
thescientist Posted September 21, 2011 Share Posted September 21, 2011 I think you should post your code as it stands now, given that you have opted to put the image in that folder as your other documents (which is a better practice). Verify again that image is named correctly, including spaces, capitlization, etc and make sure the image itself opens well in any basic image editing/viewing program. If possible, upload to someplace where we can verify paths ourselves. Link to comment Share on other sites More sharing options...
tibi Posted September 21, 2011 Author Share Posted September 21, 2011 Hi guys,sorry for the trouble here is the new syntax still doesn't work.Image opens well just not on the webpage.Upload not possible. <img src="file:\\\C:\Documents and Settings\Tnagy\Desktop\My Music\Tibi's\DSC_0119.JPG" alt="think is a picture" width="104" height="142"/> Link to comment Share on other sites More sharing options...
dsonesuk Posted September 21, 2011 Share Posted September 21, 2011 go to the folder where the image is located, right-click on image, select 'Open with' , if you have a browser within the list of programs, select that! If not, select the 'Choose default program...' from the bottom of menu list, this will open another window where another list of programs will be listed, if you can't find any browser, use the browse button to select your browser of choice from program files, once selected you return back to the list of programs, and you should see your chosen browser, uncheck 'always use the selected program to open this kind of file' checkbox, and select OK. This should now open the selected image file in the browser, and if you look in the address bar you find the correct address to use. it should be file:///C:/Documents and Settings/Tnagy/Desktop/Picture_Chips/DSC_0119.JPG all the slashes should be facing in the direction above. Link to comment Share on other sites More sharing options...
tibi Posted September 22, 2011 Author Share Posted September 22, 2011 doesn't work I tried the way u said it has the same path as before. Link to comment Share on other sites More sharing options...
Ingolme Posted September 22, 2011 Share Posted September 22, 2011 When you upen your HTML file, what URL appears in the browser? Link to comment Share on other sites More sharing options...
tibi Posted September 22, 2011 Author Share Posted September 22, 2011 I did it, but on my home computer.Everything that I wrote above was about a company computer at my work which is connected to a intranet.Even though the picture was on the computer hard drive not on the company server.Could that be a reason why I couldn't do it ?I will check the URL later today and I believe won't bother you guys with this topic again. Thank u all Link to comment Share on other sites More sharing options...
Ingolme Posted September 22, 2011 Share Posted September 22, 2011 I think I said earlier that it only works if the HTML file is running on the local filesystem. That means that the HTML file is on the same computer as the image and that it is being accessed through the file protocol. Link to comment Share on other sites More sharing options...
thescientist Posted September 22, 2011 Share Posted September 22, 2011 you should really just put it in a folder with the HTML/CSS documents that will be referencing it. As soon as you move any of these files to a different computer or upload them, all these links will break. Plus you could have a much simple file path. i.e. images/potato_chips/DSC_0119.JPG also, are you absolutely sure your casing is correct? Both in the file name and the extension? Link to comment Share on other sites More sharing options...
tibi Posted September 22, 2011 Author Share Posted September 22, 2011 Both the HTML and the picture have the same URL they are both in the same folder and the casing is correct.The curiosity is that on my home computer is working and at work computer not.I will ask the system administrator what could be the problem maybe he has the answer. Thank you guys again PSFrom my point of view case closed. Link to comment Share on other sites More sharing options...
thescientist Posted September 22, 2011 Share Posted September 22, 2011 Both the HTML and the picture have the same URL they are both in the same folder and the casing is correct.The curiosity is that on my home computer is working and at work computer not.I will ask the system administrator what could be the problem maybe he has the answer. Thank you guys again PSFrom my point of view case closed. Are you trying to access the website you've made on your local computer from work? Does this mean you have a live link for us to view then? Link to comment Share on other sites More sharing options...
tibi Posted September 28, 2011 Author Share Posted September 28, 2011 No,no it is the computer at work which has nothing to do with the home computer.Only that at home doing this exercise(inserting pictures) I manage to do it and at work no.Different computers different folders different pictures each with there own URL only the syntax is the same <img src="url" alt="some_text"/>.At home works and at work no. Link to comment Share on other sites More sharing options...
Ingolme Posted September 28, 2011 Share Posted September 28, 2011 Try typing the image's URL in the browser to see if it exists. URLs may be case sensitive, check the cases of your filenames. Link to comment Share on other sites More sharing options...
tibi Posted September 28, 2011 Author Share Posted September 28, 2011 When I do that it brings the picture up so the URL was good,no? Link to comment Share on other sites More sharing options...
Ingolme Posted September 28, 2011 Share Posted September 28, 2011 Yes, that means the URL is good. Is this page running from the file system (file:///) or localhost (http://localhost)?Are the image URLs relative or absolute? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.