View Full Version : Clarification please...

09-23-2002, 08:41 PM
In a typical html code where an image is mentioned...
I am in doubt the best way to show the SRC route...

1. where the html file and pic.jpg are in the same directory folder is the following sufficient?
<img SRC="pic.jpg" height=312 width=575>

2. where the html file might be in one folder and the pic.jpg is in another.. say in 'images' sub-directory. Is it shown thus?
<img SRC="/images/pic.jpg" height=312 width=575>

3. Or should it be shown in full... eg.
<img SRC="http://mysite.com/images/pic.jpg" height=312 width=575>

In all cases the route to the html file would be...

I hope I have explained myself clearly enough, folks. Ideally I'm after two things... a. to put all images in the same sub directory, and b. write the code to maximise speedy loading of browsers.

I generally use Composer to layout my pages and upload using an ftp client. When doing this, Composer does not usually specify any sub directories unless manually amended later... at least as far as I am aware.... hence my commom use of example <img SRC="pic.jpg" height=312 width=575>

My query is prompted by the frequency of times I've seen the code line.... images/pic.jpg but I'm only assuming that the authors are placing all (or most) site images all in the same 'images' sub-directory to save duplication of effort and site space.

And finally, is it just shown as "images/pic.jpg"
or is it "/images/pic.jpg"
or is it ".../images/pic.jpg"

Hoping someone would be kind enough to clarify these nagging questions in my mind, please.


KB... :)

09-23-2002, 08:49 PM
You can always use both relative (relative to the html document) or absolute (with http://,ftp:// in front of it) paths.
If the image is in the same folder as the HTML ,you can simply use src="pic.jpg".
If the images are in the images subfolder you can use src="images/pic.jpg".

.. means one directory level up,so ".../images/pic.jpg" would be the images folder located in the currents folder parent folder.

09-23-2002, 08:57 PM
Just use the short path (relative) for your site:src="pic.gif" as it shortens your code. Only use the full path (absolute) when including in emails and the like: src="http://site.com/me/pic.gif" :D

09-23-2002, 09:03 PM
Full paths are good for search engines, but it's a lot easier to use relative paths if you're not bothered about them, so you don't have to change every single link, image, etc when you change hosts

09-23-2002, 11:40 PM
As a rule of thumb, like-named files are stored in their own folder. Two reasons for this:
1. It's easier to administer since you know where everything is and
2: Security. Having liked named files in the same folder allows you to better set permissions (e.g. read, write,script) if that is appropriate for you.

09-24-2002, 06:15 AM
Thanks to all who responded. I sincerely appreciate it. That narrows it down to only 3261 more nagging html queries I got! :D

You all go into the draw for a cardboard replica of a block of condos!! LOL

Thanks... and Cheers!