I am creating an online service where "special users" can upload their images. It is very important that the images are not exposed to anyone else than the user who uploaded them. I have heard that the best way to protect the images is to put them over the webscope.
So far so good.
My problem is that i can't display the images, how is this done? The application is written in PHP and the directory structure is like this:
/ # this is where i placed the images /www /www/domain.com/ # This is the root of the website
I have put up a testscript to retrieve the images with this code
header('Content-type: image/jpeg'); $image = imagecreatefromjpeg( realpath('../../image.jpg')); imagejpeg($image); imagedestroy($image);
which delivers the image to this file which displays it
<img src="retrieve-image.php" />
Can anyone please tell me what I am doing wrong? Can it be the php.ini which is set incorrectly? Is there a more easy way to protect the images?
Thanks in advance !!
// Mathias Bak
P.S. How do i write code in my post the proper way??