Ok, so I am trying to link to an image that is in a folder that is higher up in the hierarchy. I have set the file permissions on both the folder and the image to 0755. I have not had any problems linking to images in the same folder.
Here is the img tag I am using:
echo "<img src ='../../../../uploads/dragonBanner.jpg' style ='margin-bottom: 25px' alt ='user added banner' title ='user added banner' /><br />";
The ../'s are the correct amount, and when the page displays I get the alt content.
Any ideas would be much appreciated...
Thanks,
SuMWuTT
linking to a folder higher up in the hierarchy
Moderator: General Moderators
Re: linking to a folder higher up in the hierarchy
Try browsing to the image itself and see what happens.
Re: linking to a folder higher up in the hierarchy
Tried that but the uploads folder is above the www entry folder from the web. So I can't get to it from the browser.
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: linking to a folder higher up in the hierarchy
If it's outside of the web server root, then you can't access it using the img tag <img src="../img.gif"> unless you write a little script that can read outside of the web server root and use <img src="imgScript?img=../img.gif">sumwutt wrote:Tried that but the uploads folder is above the www entry folder from the web. So I can't get to it from the browser.
Re: linking to a folder higher up in the hierarchy
Rule of thumb: If you can't access it by typing the URL into the browser, you can't access it with an HTML tag.
In order to make a script output the image, try something like the following:
In order to make a script output the image, try something like the following:
Code: Select all
$image_data = file_get_contents( "path/to/image.png" );
header( "Content-type: image/png" ); // You'll need to change this to the appropriate MIME type, of course.
echo $image_data;Re: linking to a folder higher up in the hierarchy
thank you,
I will try this, although I am not sure how to apply this to the code I am using.
sumwutt
I will try this, although I am not sure how to apply this to the code I am using.
sumwutt
Re: linking to a folder higher up in the hierarchy
I had some trouble implementing your code syntac, but I did find a place in the hierarchy that the upload took and I could access it using my original code.
I will continue to work on the code you gave me though as I can't stand to give up on anything.
thanx for help all it was much appreciated.
I will continue to work on the code you gave me though as I can't stand to give up on anything.
thanx for help all it was much appreciated.