I need some help/ideas with this : I'm using session for user's authorization and need to access "private" image data or access to some directory for authorized user only. My question is how to protect images (image file or directory) with session (I mean no HTTP basic authentication scheme is allowed) ?
I've tried something like this, but it doesn't work properly probably due to the directory rights.
<?php function LoadJpeg($imgname) { $im = @imagecreatefromjpeg($imgname); if (!$im) { /* See if it failed */ /* Output an errmsg */ } return $im; } /* if (user logged in) */ header("Content-Type: image/jpeg"); $img = LoadJpeg("private/image.jpg"); imagejpeg($img); ?>
Some ideas how it's done would be appreciated.
TIA