Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

beginner's simple question-select image source 2

Status
Not open for further replies.

tempo1

Programmer
Feb 20, 2007
118
0
0
Hi everyone,
I want to load an image.
At the "select image source" the "relative to" box, i'm required to choose either"document" or "site root" and i dont understand the implication of each selection.
Can anyone explain me that ?
Thanks
 
Is your image in a directory under the site root (i.e. where your index page resides) or in a directory under the current page (document)?

You may have an images folder that contains all of the images for your site and that folder is under the root directory. Choose 'site root'. Images will show up in your html as ../images/yourpic.gif

For one particular page you may have images in a sub-folder or the same folder as the page in question. Choose 'document'. Images will show up in your html as /images/yourpic.gif or yourpic.gif, respectively.

Hope that clarified the matter somewhat.

If you do not have any pages in folders outside of the root folder, the end result would be essentially the same.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Actually that's the wrong way around


root relative has a leading slash "/"

document relative will use the "../" syntax.


The best way is to use root relative always. then all references to folders, files & images will be consistent throughout the site.

Using document relative for images in a root level "/images/" folder will have to use an extra ../ for each sub folder the document is below the root.
as an example;
images/pic.jpg

from root = src="images/pic.jpg"
from a subfolder /aboutus/ = src="../images/pic.jpg"
from a subfolder of "/aboutus/contact/" = src="../../images/pic.jpg"

for root relative all references would be src="/images/pic.jpg " no matter where the documents where.

The value of this becomes more important if and when you move on to programming, so scripted solutions do not have to work out where a document is going to be located when you are coding links and image references.



Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
Chris is, of course, correct. That might teach me to think before answering.[blush]
See Understanding document locations and paths and follow the two links for Adobe's explanation.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Thanks a lot Chris.
Thank you Greg for the links.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top