davideo7
asked on
PHP htaccess Watermark Hotlinked images
I have a PHP script which places a watermark on images on my site. How could I make it so that it only watermarks my images if they're placed on another site?
Here's my .htaccess code:
Thanks.
Here's my .htaccess code:
RewriteEngine on
RewriteRule ^(.*\.(jp?g))$ /videogames/watermark.php?image=$1&watermark=watermark.png [NC]
Thanks.
ASKER
Ray_Paseur: If they got hotlinked. How would I go about doing this with htaccess?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What I would suggest (without having thought this through in great detail or even tested the idea) would be to use PHP scripts to render your images. The scripts could check the $_SERVER["HTTP_HOST"] and $_SERVER["HTTP_REFERER"]. It the values indicate your site, render the image unwatermarked. Else watermark.
If you put the image files outside of your web root they will not be browsable (no URL) and that may help enhance security.