cancel
Showing results for 
Search instead for 
Did you mean: 

Images Outside the Webroot in a webpage?

Grafter
Posts: 84
Registered: ‎03-08-2007

Images Outside the Webroot in a webpage?


I want to store images (.jpg) in a folder above the webroot on a linux server.
I know it is possible to read a file from a folder outside the webroot using php and place it into a webpage using image tag.
Done anyone know how this is done and what the code might look like?
Any help would be marvelous!
Many thanks
godricbj
2 REPLIES 2
Community Veteran
Posts: 1,577
Thanks: 3
Registered: ‎13-04-2007

Re: Images Outside the Webroot in a webpage?

Do you have full control of the server ie can set permissions etc?
It all depends were its stored if its on the local hard disk and not any part of the web server then you have got to address it as a file ie c:\mypictures if its any were on the web server then it can be addressed as a URL.
If you can tell use were it is ie the directory then we can give you the code. Most people would use a mysql database or you could just use html to give the file a path name
Grafter
Posts: 84
Registered: ‎03-08-2007

Re: Images Outside the Webroot in a webpage?

Hi
thx for your help... it goes like this.
I am using a php image gallery called Slooze.
This is on a linux server and the gallery .php files are parked in two places.
The "programme" files are above the webroot and the display templates for users and admin are in the webroot.
Because they are in the webroot and they are .php I can protect them with a php password system from the mysql.
Slooze makes direct html calls to the images using the image tag... so the images files have to be in the webroot.
Slooze would really like to create its own thumbs, but I don't want to give it write permission on a folder in the webroot and .htaccess is not a convinent way to protect the images.
So....
I want to make a folder above the webroot, with write permission and call the images from it using php placed below the webroot.
It's a linux server and I do have control of folders and permissions directly above the webroot.
In fact I have succeeded in making a link that opens an image from an html link!... but not to open the image in the same page.
Bit long, but its not that simple, to me anyway.
Any help would be brilliant.
thx
godricbj