Here is the directory structure
/domain.com
/public_html
/functions
/image
/mobile
/www
the /domain.com/public_html/www folder has a file index.php
the default web directory is /user/public_html/www
in the index file is an include that includes the functions with
include"../functions/function.inc"
this works without problem
when I want to link to a picture in the image folder I don't get any results
for example
<img src="../image/graphic/logo.gif" alt="alt text"/>
Does anybody has any idea why the link to the image does not work and how to link correctly to the image file ?
I tried <img src="<?php echo $_SERVER['PHP_SELF']; ?>../image/graphic/logo.gif" alt="alt text"/>
but that gives me the same result
when I build a link around the image to get to the properties I get this as path
http://domain.com/image/pc/tattoo_small/small_2008_10_22_001.JPG
the path should be
http://domain.com/public_html/image/pc/tattoo_small/small_2008_10_22_001.JPG
when I try to browse directly to this url
http://domain.com/public_html/image/pc/tattoo_small/small_2008_10_22_001.JPG
I get an 404 file not found error
because the default web directory is
/domain.com/public_html/www
I tried
http://domain.com/../image/pc/tattoo_small/small_2008_10_22_001.JPG
to get to the image folder but that does not help neither.
Anybody any ideas or is it impossible to html link to graphical files outside the default web directory ?
thanks for reading this far
Thanks for the answers so far.
I will try to solve my problem with one of the recommended solutions and report my working solution back here.
I wanted to have the image folder at the same level as the www and mobile folder because some of the images used for the pc (www) version and the mobile version are the same.
Of course it is easier to just get an image folder in the www and in the mobile folder and I think that is what I am going to do.
thank you everybody for the advice. The main reason why I am not going to work with a script is that a script will be a difficult solution to an easy problem and also because I don't really see how you can wrap your image in a css class and how to provide alt text for an image.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…