Results 1 to 9 of 9

Thread: placing files

  1. #1
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    903
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Default placing files

    How can I place an image that is stored in another map on the server, without placing the whole adress ?

    where the page is: img/one/two/three/image.html
    where the image is that I need to place in that page: img/one/image.gif

    How can I solve that without placing http://www.mysite.com/img/one/image.gif ?

    I thought placing .../ would refer to the main file.

  2. #2
    Join Date
    May 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ../ is used to go back a folder, so i think it would look like this:

    HTML Code:
    ../../image.gif

  3. #3
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    903
    Thanks
    114
    Thanked 2 Times in 2 Posts

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    ../../image.gif should indeed work. /img/one/image.gif is always an option too.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,497
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The relative path:

    ../../image.gif

    will work if the image.gif is in the root and the page is, say - here:

    /pages/image_pages/page_1.htm

    But, that wasn't the question, was it?

    /img/one/image.gif

    will work in the situation described.

    Whenever you start with the ../ stuff (or even paths like these:

    img/one/image.gif

    without the beginning slash that denotes the root of the domain), it depends upon not only where the image is but, also where the page that is supposed to display the image is in relation to the image. Those ../ things are part of what is called the relative path. If you don't understand relative paths, don't use them.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    This also depends on which level (or directory) of the website you're browsing, it constantly changes Once you get a hang of it though, it's easy.
    - Mike

  7. #7
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    903
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Default

    So if I have the following in the root directory
    - img/one/two.gif
    - EN/index.html
    I need to place in the index .../img/one/two.gif ??
    It doesn't work, but maybe it is because I am working offline ?

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,497
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by chechu View Post
    So if I have the following in the root directory
    - img/one/two.gif
    - EN/index.html
    I need to place in the index .../img/one/two.gif ??
    It doesn't work, but maybe it is because I am working offline ?
    Not:

    Code:
    .../img/one/two.gif
    Three dots doesn't mean anything, as far as I know. The relative path for this case you described in the above quote would be:

    Code:
    ../img/one/two.gif
    And, it works locally and live as long as the relative directory structure (not the distance to the root) is the same in both locations. That is the one major advantage of the relative path. One dot (.\) means 'this folder' two dots (..\) means 'one folder closer to the root'.

    Of course, all of the other normal things not relating to path must be done correctly as well like, but not limited to:

    • The files and paths must exist and be named as you describe, case matters.
    • The HTML code using the image must be valid and to be seen, have attributes and style that allow it to be seen.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    903
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Default

    Dear God, a difference of one dot ..........
    Now it works indeed. Forgive me my stupidity !

Bookmarks

Posting Permissions

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