Jump to content

Question Regarding Images


Egghead

Recommended Posts

Hey all; I am a complete newb to Web development, I am just learning html and xhtml and css for the moment, only on my second day of learning. While experimenting with a web page file on my computer, I decided to put in an image. The thing that gets me is, for an image that is stored on the computer itself (since the page file is not on any server), how do I put this into the code? Do I need to put in the entire pathway to the file or something? If I just put the name of the image, then the browser has no idea where in the computer to locate the picture from what I understand; I also don't know quite what type of image these images are in the computer; in the code examples, it is usually a gif, but I don't think any of these images are gif's, maybe they are something else but I am not sure. Any help is appreciated.Thanks,---Egghead---

Link to comment
Share on other sites

To include an image that is on your computer you should use the complete path (C:/image.gif).There's mostly 4 image formats on the web: gif, jpg, png and bmp. Each have their advantages and disadvantages. Use any of them except for bmp that I wouldn't recommend.

Link to comment
Share on other sites

To include an image that is on your computer you should use the complete path (C:/image.gif).
not neededyou can use the relative paths on your computerlike <img src="someimage.jpg" /> if its in the same foleror<img src="/images/someimage.jpg" /> if its in a sub folder called "images":)
Link to comment
Share on other sites

Ahhh, okay, I got a pic in :) Now if the file for the code of the webpage is in one file and the picture is in a completely separate file, way off on a separate path, should that work too, provided you give the complete pathname? (that is what I originally tried, but it didn't work, but maybe I was doing something wrong).Thanks,---Egghead---

Link to comment
Share on other sites

One other question; I just used an image to make a link to another website. Well the link worked fine, I clicked on the picture and it went to the website, but the problem is that when I go to the site through the link, none of its pictures show up. If I type the url into the bar and go to the site that way, the pics on the site show up fine, but if I go to it via my link, the site works fine but no pics. Where the pics should be are just blank rectangles with the big red X in the corner. What is causing that?

Link to comment
Share on other sites

about your first question - its best to keep your html pages and images clsoe together, either in the same folder or have the images in a subfolder. It cuts down on any extra code you have to write by keeping the paths to images short, plus its easier to manage.your 2nd question about a link, which site is it? can you place a link here? Are you linking it from your computer or another website? And how have you linked to it?:)

Link to comment
Share on other sites

The site itself can't be it because I tried multiple sites that normally work fine, but when accessed via the link the site would come up but without the pictures. When accessed in the normal way, however, they work fine. I am linking to it from my computer via a webpage on my computer. Basically I put the link in the html code, then I go into Internet Explorer, go under File, click Open, then open up my webpage (which is just a .html Notepad file). The browser brings it up and it looks like a regular webpage, only it isn't being hosted. Well I do this with the computer hooked up to the internet, so that then I click on the link and it goes to the correct website (so I know the address is correct in the code), but the pictures of the site don't show.

Link to comment
Share on other sites

then I go into Internet Explorer
IE has some funky security settings in place when you load an html file locally. This could be the cause of your issues.
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...