I have a php script that watermarks hotlinked images that isn't working, I always get the linked image. I think the problem is in the htaccess file and I can't figure out why it doesn't work. When I go to this url the php file shows the watermarked image http://www.example.com/watermark.php?path=http://www.example.com/photos/image.jpg
This is the code I have.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !example\.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.*) watermark.php?path=$1
#or RewriteRule (.*) /watermark.php?path=$1
The reason I think it is the htaccess and not the php file is that when I have these two lines in the php file it still does not work.
header('Content-type: image/jpg');
readfile('images/sun.jpg');