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