Hi
The problem is that if you don't allow the user to have access to an image then you can not use the image in a HTML because the user will still need access to view it.
But there is one thing I could come up with to protect images.
Put your images in a folder which users don't have access to. Then you can use PHP GD to serve the image only to a specified user.
Here is the code to serve the image by PHP GD:
imageviewer.php
-
<?PHP
-
// if the image in a GIF use imagecreatefromgif
-
// if the image in a PNG use imagecreatefrompng
-
-
$img=imagecreatefromjpeg("yourImage.jpg");
-
imagePNG($img);
-
imagedestroy($img);
-
?>
-
-
Then as the SRC of your image tags of your HTML code use the above PHP file like this:
-
<img src="imageviewer.php">
-
There are currently many websites using this method to protect their photos.
In some websites when you right click on an image and go to properties the only address you can see is a PHP file.
And don't forget that GD must be enabled on the server you are excuting your script on. Most of the servers have GD enabled by default.
Hope this helps you