Instead of <IMG SRC="img/picture1.jpg"> replace SRC with
"get_picture.php/1".   get_picture.php checks whether the user is
logged in and if so uses the following PHP code to return the picture.

$fileno = $_SERVER['QUERY_STRING'];
$filename = "/picture/directory/not-below-webroot/PICTURE" . $fileno .
".jpg";
$image = imagecreatefromjpeg($filename);
if ($image == null)
{
        return;
}
header("content-type: image/jpeg");
imagejpeg($image);
imagedestroy($image);

This requires that PHP be configured with the gd library.   I'm not
sure if that is common or not.


On Oct 17, 7:23 am, Jacob83 <[EMAIL PROTECTED]> wrote:
> Nobody knows about a solution for this problem?
> I think it's a very common question, isn't it?
>
> On 6 Okt., 07:58, Jacob83 <[EMAIL PROTECTED]> wrote:
>
> > Hi out there,
> > is there any way to limit access to a directory to logged in users
> > only? i.e. i don't want everybody to be able to see my pictures/
> > documents by simply entering the url.
> > I think I'll have to use a php file which flushes the file ... (bad
> > performance??)
> > but perhaps someone has already written something like this...
> > Regards,
> > Jacob


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to