Relative path

I’m trying to create a relative link for an image, but I can get it to work for some reason. The page and the images folder are in the same folder.

Why doesn’t this path work?

<img src=“…IMAGES/sports-club.gif” width=“613” height=“357” alt=“Gym bulding photo” id=“Building” />

This is the site

http://devb.bambl.clients.blinkss.com/

file addressing notation:


../dirname/filename  (from the parent directory, go to path/filename )
./dirname/filename  (from the current directory, go to path/filename )
/dirname/filename  (absolute addressing; relative to the root directory, go to /path/filename )
dirname/filename  (same as ./)(from the current directory, go to path/filename )

Delete the two dots before IMAGES.

Thx…I tried that before I believe and just now and it didn’t work…

Try again. I made an error. The post has been edited. Sorry.

Still nothing…#Doh

This is the relative path to your images:

src=“wp-content/themes/Newport_Sports_Club/IMAGES/sports-club.gif”

In a WP site, the “page” and the images folder are not usually (if ever) in the same folder.

Thanks, Ralph. :slight_smile:

Ah, yes, WordPress uses URI paths for everything.

Well, what folder is the page and style sheet supposed to be in then? I have 4 sites and they all have the pages in the theme’s name folder (i.e.

wp-content/themes/theme_name/index.php or header.php, etc.)

And the images folder is in the same same folder as the index.php file.

I feel like there is something missing here…

Forget about page location in WP, as pages are dynamically created and have no actual “location”. If you want buttetproof image links, always use this on this particular site:

src=“/wp-content/themes/Newport_Sports_Club/IMAGES/sports-club.gif”

Note the / at the front. That way, the link will work from any part of the site, even in the stylesheet links.

If the path that Ralph posted began with a slash, it would be an absolute path and should work from either the css or index page.


src="/wp-content/themes/Newport_Sports_Club/IMAGES/sports-club.gif"

Off Topic:

bested by Ralph :slight_smile:

Wooohoooo! Thx.

This worked,

<img src=“/wp-content/themes/Newport_Sports_Club/IMAGES/sports-club.gif” width=“613” height=“357” alt=“Gym bulding photo” id=“Building” />

Glad we could help. :slight_smile:

[ot]

There’s a lot of argument over whether that should be called “absolute” or not, and these days I side with those who call it a “root relative” path, reserving “absolute” for the full URL (such as [noparse]http://mysite.com/wp-content/themes/Newport_Sports_Club/IMAGES/sports-club.gif[/noparse]). Only the full URL is truly absolute, as it works from anywhere, whereas the root relative link is only absolute within the content of the site itself (it’s not even absolute in relation to the server the site sits on). [/ot]

BTW - the reason the following code does not work is because of the leading slash.


<img src="/IMAGES/sports-club.gif"

dots, slashes and paths matter. See post # 2.

Off Topic:

Obviously, I lean toward the old fashioned, conventional definitions and usage.
URL or URI means “universal resource locator or indicator”, as in works from anywhere.
absolute refers to a specific location (the top-most directory, on a computer).