Gossamer Forum
Home : General : Internet Technologies :

SSI and Image Paths Problem

Quote Reply
SSI and Image Paths Problem
Hi,

When you use images in a file that is included in on all pages across a website the images disappear if the file is included from a different directory.

e.g index.shtml
calls the directive top.html
which has images embedded in the page from the folder
images

The problem arises when you include the top.html in a file from a different directory.

e.g mynewdirectory/file_2.shtml
call the directive top.html
but top.html still has the images from the folder
images
where now it has been included in a different directory so the images path has changed and now should be
../images

How to you solve this problem other than adding the images folder to every new directory?

Thank you for your help.

Regards
Mark
Quote Reply
Re: [travalian] SSI and Image Paths Problem In reply to
You could always use the full URL instead of using relative links, right?

<IMG SRC="http://www.yourdomain.com/images/picture.jpg" ALT=" " HEIGHT=" " WIDTH=" ">
Quote Reply
Re: [travalian] SSI and Image Paths Problem In reply to
As I already mentioned with the CSS/SSI issue, use RELATIVE PATHS, they are key. I would recommend not using the full domain address in the img src tag.

<img src="/images/yourimage.gif" alt="" width="" height="" border="0">
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Watts] SSI and Image Paths Problem In reply to
Thanks Watts,

That is one way around it, except I'm developing the site on a test server - thus the domain will change when I have completed the site :(

Regards

Mark
Quote Reply
Re: [travalian] SSI and Image Paths Problem In reply to
Thus the reason for not using domain addresses in the img tag, use the above example I gave you and it will work.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] SSI and Image Paths Problem In reply to
Hi Stealth,

I am using relative links - that's why it isn't working, because the the include is added to a file in a different directory - the relative path changes and thus the image is not there.

I currently can't use absolute paths - any ideas would be appreciated.

Thank you.

Regards

Mark
Quote Reply
Re: [Stealth] SSI and Image Paths Problem In reply to
This is the problem that I'm experiencing using relative links:

index.shtml

top.html

relative image link:

<img src="/images/pic.gif" alt="" width="" height="" border="0">

Now there is a directory change

newdirectory/file_2.shtml, still using the same top.html file

top.html

Using the same file in a new directory changes the image path to:

<img src="../images/pic.gif" alt="" width="" height="" border="0">

Therefore the image is not at this location.

How do you solve this?

Thanks

Mark
Quote Reply
Re: [travalian] SSI and Image Paths Problem In reply to
What I would suggest is the following...

* Create another website in your test web server (so that you don't have to monkey around with changing img and href tags in your new set of web pages).

* Use the full relative path as I already discussed.

You could also add a symlink to top.html for your second test website.
========================================
Buh Bye!

Cheers,
Me