Showing images outside web root 
Author Message
 Showing images outside web root
What's the best way to show images that are placed outside the web root that
works on Apache and IIS?

Nino



Sun, 31 Jul 2005 05:33:33 GMT  
 Showing images outside web root

Quote:

> What's the best way to show images that are placed outside the web root that
> works on Apache and IIS?

> Nino

picshow.php:
------------
<?
        $pic = $_REQUEST['pic'];

        readfile ($pic, "/path/to/my/images/");
?>

I think that should work okay, it might take some tweaking.

I would make sure that it's not possible to go below the include dir
(/path/to/my/images/) by passing pic=../../my.png, I don't think it is
possible, however. You might want to strip the path off $pic just in case.

Also, the user running the webserver needs read access to the
appropriate files/directories.

--
Ryan



Sun, 31 Jul 2005 05:59:24 GMT  
 Showing images outside web root
On Tue, 11 Feb 2003 15:59:24 -0600, sik0fewl

You'll probebly need a content type header too

header ("Content-type: image/gif");  (or image/jpeg or image/png or
whatever)

Quote:

>> What's the best way to show images that are placed outside the web root that
>> works on Apache and IIS?

>> Nino

>picshow.php:
>------------
><?
>    $pic = $_REQUEST['pic'];

>    readfile ($pic, "/path/to/my/images/");
>?>

>I think that should work okay, it might take some tweaking.

>I would make sure that it's not possible to go below the include dir
>(/path/to/my/images/) by passing pic=../../my.png, I don't think it is
>possible, however. You might want to strip the path off $pic just in case.

>Also, the user running the webserver needs read access to the
>appropriate files/directories.



Wed, 03 Aug 2005 21:11:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Root window outside of current program

2. displaying an Image using PIL w/o Image.show

3. i found the perfect python web host with root access

4. Setting the root image on Windows?

5. Image not showing up on all computers

6. Show a contact point in an specimen image

7. Compare a VGA-Snapshot with the actual shown image

8. CP shows "Unknown Image Format"

9. Show image in CVF 6.6b

10. Is this way of showing images OK?

11. How to show jpeg image in Tcl/Tk

12. showing xpm images in Tix

 

 
Powered by phpBB® Forum Software