How to protect against direct access to images?
Add a simple .htaccess
file in your site folder with the follwoing lines
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www\.your-domain\.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www\.your-domain\.com$ [NC]
RewriteRule .*\.(wav|swf|jpg|jpeg|gif|png|bmp|js|css)$ - [F,NC,L]
Note I added also js
and css
file even if I think it's bizzare to find someone who attempts to scrape them.
http://us3.php.net/image
You link the img element to a php file. This file checks if the user has the right permission, if so it can send an img response back.
<img src="url/LoadImg.php?id=1337" alt="" />
Still someone with the permission can download the image and provide it to other people somewhere else (webspace/mail/whatever). To make it a bit harder to steal it you can disable right clicking on the image, but still a user who knows a little bit about http should not have any problems to steal it. You can place a signature over the image (for example the logo/name of your website) so people can see that you where the source. This can be done with php aswell.
If you want to be funy you can setup an other image that is sent if the link comes from an other page :P