• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

dumb question, how do I link to a local img in html?

Yossarian

Lifer
Dec 26, 2000
18,010
1
81
I want to see how some pics will look before I upload them to the site. Apparently I'm not listing the path correctly, is there some trick to get a local pic to load?
 

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
You can just put in a path that's relative to the HTML file. So <img src="picture.jpg"> would show a picture that's in the same folder as the HTML file. "images/picture.jpg" would look in the "images" subfolder that's in the same folder as the HTML file.
 

Joemonkey

Diamond Member
Mar 3, 2001
8,859
4
0
do you need a leading forward slash for that?

suppose I had a directory structure, in the root i had index.htm, pic.jpg, and a folder called pics with pic2.jpg in it

to link to pic.jpg on the index.htm file, it would be img src=pic.jpg

to link to pic2.jpg it would be img src=/pics/pic2.jpg right?
 

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
Originally posted by: Joemonkey
do you need a leading forward slash for that?

suppose I had a directory structure, in the root i had index.htm, pic.jpg, and a folder called pics with pic2.jpg in it

to link to pic.jpg on the index.htm file, it would be img src=pic.jpg

to link to pic2.jpg it would be img src=/pics/pic2.jpg right?

The leading slash means that the image is relative to the root directory. So <img src="/folder/this/that/pic.jpg"> will be basically be <img src="www.domain.com/folder/this/that/pic.jpg">