RE: [PHP] Images out side the wwwroot

2003-03-10 Thread Don Read

On 10-Mar-2003 Philip J. Newman wrote:
> If i was to use PHP to call all my images from out side the wwwroot, dose
> anyone have a method that they use?
> 

show.php
-
 'image/jpeg',
'jpg'  => 'image/jpeg',
'gif'  => 'image/gif',
'mpeg' => 'video/mpeg',
'mpg'  => 'video/mpeg',
'mov'  => 'video/quicktime',
//  'avi'  => 'video/avi',
'avi'  => 'video/x-msvideo',
'wmv'  => 'video/x-ms-wmv',
'asf'  => 'video/x-ms-asf',
'png'  => 'image/png'
);


if (! isset($id))
die('no id.');

$id= urldecode($id);
$id= str_replace('../', '', $id); // fix the dodgy stuff
$id= trim($id);

if (! ($allowpath) )
$id= basename($id);

$ext= substr(strrchr($id, '.'), 1);
$path= $imgdir .'/' .$id;

if ($handle= fopen($path, 'r')) {

Header('Content-type: ' .$mimetype[$ext]);
Header("Content-Disposition: inline; filename=" .basename($id));

fpassthru($handle);
fclose($handle);
}
?>


call it as 'show.php?id=secretimg.jpeg' or use 
IMG SRC="show.php?id=secretimg.jpeg" 

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Images out side the wwwroot

2003-03-09 Thread - Edwin
"Philip J. Newman" <[EMAIL PROTECTED]> wrote:

> If i was to use PHP to call all my images from out side the 
> wwwroot, dose anyone have a method that they use?

By using an absolute path?

- E

__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Images out side the wwwroot

2003-03-09 Thread Philip J. Newman
If i was to use PHP to call all my images from out side the wwwroot, dose
anyone have a method that they use?

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php