Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: weird images

  1. #1
    Senior Member boolean's Avatar
    Join Date
    Jun 2003
    Posts
    161
    Member #
    1615
    Hi,
    Yes, I know this is some stupid simple thing... but.....

    Why is it now when I do something like:
    <img src="/images/image.jpg">

    it wont work, and I have to change it to:
    <img src="images/image.jpg">

    (had to get rid of the forward slash)

    I think it used to work before.... or it worked on a different server.
    Any ideas?

  2.  

  3. #2
    Senior Member mossoi's Avatar
    Join Date
    Apr 2003
    Location
    Englandshire, United Kingdomsville y'all!
    Posts
    1,111
    Member #
    1206
    Liked
    1 times
    The / before the image location tells the server to go back to the root of the directory tree for that site.

    So if you browse a file within your site such as www.mydomain.com/support/index.php any reference to any image with a preceeding / will look for www.mydomain.com/image.gif.

    Take away the / and the browser will look to www.mydomain.com/support/image.gif as the file is already in that folder.

    It's the same as navigating through directories in DOS: cd\ (\ instead of / because we're on the local file system now) will take you back to the root of the drive whereas cd.. will take you up a level.

    So you can use anchors that include something like ../image.gif or ../index.php to tell the browser to move up one level of the directory tree.

    It's handy when you have a large site with several levels to use this system.

    I tend to put all my images in a folder called images on the root of the site and then all my a href's begin with \. That way if you move any files you won't break any links if the relative locations of the files changes (providing you always keep the images folder in the root of the site).

    EDIT: BTW using / is known as absolute linking whereas without it is relative linking. There are loads of sites explaining the advantages of using both systems dependant on the environment.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:08 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com