Snaylor Posted July 6, 2008 Share Posted July 6, 2008 Hello,I have been trying to add an image thats on my computer to an HTML file I am creating. Without success! The file im trying to upload is saved in Jpg format called antispywareheader1.jpg It's meant to be a header banner for my product comparison page im creating.This is the code im using in my html document.<img src="antispywareheader1.jpg" width="750" height="120">I've been trying all sorts to make it work but it just comes up with a empty box with the little red cross in it!What am I doing wrong?Help would be appreciated.ThanksSimon Link to comment Share on other sites More sharing options...
Shonumi Posted July 6, 2008 Share Posted July 6, 2008 Well, seeing as that you are trying to upload the file, it should be a simple matter of the file's pathway. Let me ask you this, have you already uploaded the file via FTP or through some other sort of file manager available on your website? If not, do so. If so, then make sure that the pathway is either absolute, i.e. you have the src attribute set to something like this, where it has the full web address of the image's location. <img src="http://www.my_site/product.jpg" alt="pic" /> Or if you have the image on your server and the HTML page resides in the same directory, then you can just have the image file's name plus extension like you have been doing, just make sure they're both in the exact same folder. See if you can get this all to work on your hard drive first (better do it with relative paths, the way you've been trying to do it) before moving these to your server.If you're actually trying to have the HTML page on your server link to an image on your computer, that's not advised, as other people won't be able to see it, so just make sure you upload both the HTML file and the image. Link to comment Share on other sites More sharing options...
Snaylor Posted July 6, 2008 Author Share Posted July 6, 2008 Well, seeing as that you are trying to upload the file, it should be a simple matter of the file's pathway. Let me ask you this, have you already uploaded the file via FTP or through some other sort of file manager available on your website? If not, do so. If so, then make sure that the pathway is either absolute, i.e. you have the src attribute set to something like this, where it has the full web address of the image's location.<img src="http://www.my_site/product.jpg" alt="pic" /> Hi shonumi, I have just tried this and unfortunately it has made things worse. I cant even see my website now.I tried it like this <img src="http://www.antispywareservices.com/antispywareheader1.jpg alt="antispywareheader" width="750" height="120"> Or if you have the image on your server and the HTML page resides in the same directory, then you can just have the image file's name plus extension like you have been doing, just make sure they're both in the exact same folder. See if you can get this all to work on your hard drive first (better do it with relative paths, the way you've been trying to do it) before moving these to your server.This was originally what I was trying to do. Im not sure what relative paths are. Could you give me an example or explanation? How do you make sure they are both in the same directory. My computer seems to be anti graphics for some reason. Link to comment Share on other sites More sharing options...
aquatsr Posted July 6, 2008 Share Posted July 6, 2008 <img src="http://www.antispywareservices.com/antispywareheader1.jpg alt="antispywareheader" width="750" height="120"> If this is exactly the code you have, you need another double-quotes after .jpg, like this: <img src="http://www.antispywareservices.com/antispywareheader1.jpg" alt="antispywareheader" width="750" height="120"> Link to comment Share on other sites More sharing options...
Snaylor Posted July 6, 2008 Author Share Posted July 6, 2008 Hi guys,Thanks for your help both of you. I have managed to get this sorted and up and running.I really appreciate the help you two have given me Have a look if you like www.antispywareservices.com Simon Link to comment Share on other sites More sharing options...
Snaylor Posted July 7, 2008 Author Share Posted July 7, 2008 One more thing....What's the HTML code for aligning the header to the center?I tried putting in the align="center" but this didnt have an effect. Link to comment Share on other sites More sharing options...
23.12.2012 Posted July 7, 2008 Share Posted July 7, 2008 It's <div align="center"> Link to comment Share on other sites More sharing options...
Ingolme Posted July 7, 2008 Share Posted July 7, 2008 It's <div align="center"> It's <div style="text-align: center">, if your header is an inline object.If it's a block level object, add style="margin: 0 auto;" to the element you want centered. Link to comment Share on other sites More sharing options...
23.12.2012 Posted July 7, 2008 Share Posted July 7, 2008 I thought that he wants the HTML code, w/o CSS Link to comment Share on other sites More sharing options...
furyan Posted July 29, 2008 Share Posted July 29, 2008 wel, i also got a questiondoes the image has to be in the same folder as your webpagefor examplemy file "Loïsism.htm" is stored under C:\documents and settings\usernamemy image (.bmp format) is stored under C:\documents and settings\username\documents\received filesnow i've put a code in <img src="C:\documents and settings\username\documents\received files\photo.bmp" alt="-ERROR-"> now the photo doesnt show up, help pls :s Link to comment Share on other sites More sharing options...
Ingolme Posted July 29, 2008 Share Posted July 29, 2008 You probably have to use the file protocol since it's on your computer:<img src="file:///C:\documents and settings\username\documents\received files\photo.bmp" alt="-ERROR-"> Link to comment Share on other sites More sharing options...
furyan Posted July 29, 2008 Share Posted July 29, 2008 thanks, it works now ^^if i send the htm document to another person, the scr must be changed right? Link to comment Share on other sites More sharing options...
Ingolme Posted July 29, 2008 Share Posted July 29, 2008 Most likely it won't work because you wouldn't know what to change the src attribute to.If you send the page, you'll have to send the image too. I usually recommend having a set of folders relative to your document to send with it. Link to comment Share on other sites More sharing options...
furyan Posted July 29, 2008 Share Posted July 29, 2008 lol, i can change the scr, becuz its only to 1 person who is my best friend, and i asked the exact location ^^ Link to comment Share on other sites More sharing options...
23.12.2012 Posted July 30, 2008 Share Posted July 30, 2008 lol, i can change the scr, becuz its only to 1 person who is my best friend, and i asked the exact location ^^Don't confound src with scr. I've seen many people believing that it's IMG SCR, SCR standing for SCRIPT, which is WRONG. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.