Piran is right, use rewrite rules to redirect all requests for a picture to a php-script:
RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.myserver.nl [NC]
RewriteCond %{HTTP_REFERER} !^http://www.allowedserver.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteRule (.*) /showpicture.php?pic=$1
and then use the php-script showpicture.php to:
- check referrer
- retrieve the picture from another directory that is usually not reachable
I've put the pictures in an directory in /home/e-smith/files/primary, but NOT html, files or cgi-bin.
But, someone could still copy your pictures, this only stops hotlinking. Look here,
http://www.alistapart.com/articles/hotlinking/, that's where i've got a big part of the code from.