Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adelaide, South Australia
    Posts
    150
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Clarification please...

    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...
    http://mysite.com/my.html...
    or...
    http://mysite.com/anyfolder/my.html

    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.

    Cheers

    KB...
    To escape criticism - do nothing, say nothing, be nothing. . . Vaya Con Dios

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,649
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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"
    Last edited by zoobie; 09-23-2002 at 09:00 PM.
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    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

  • #5
    umm
    umm is offline
    Regular Coder
    Join Date
    Sep 2002
    Location
    Antipodes
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adelaide, South Australia
    Posts
    150
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Heyyy that was easy, huh?

    Thanks to all who responded. I sincerely appreciate it. That narrows it down to only 3261 more nagging html queries I got!

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

    Thanks... and Cheers!
    KB...
    To escape criticism - do nothing, say nothing, be nothing. . . Vaya Con Dios


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •