I have a Wordpress website, due to some limits i need to have originals of the photo at the serverside, but watermarked ones on a frontend and with direct opening of the photos. I'm using Frontend content creation plugin and (as i understand) not all the plugins will fork with custom file input fields (wp_handle_upload used). I've found good solution: php file + htaccess setting with RewriteRule. The problem is that it isn't work for me for some reason.
The solution is: http://dolcepixel.com/how-to-watermark-all-your-uploaded-images/
When i opening file with:
/watermark.php?p=br&q=90&src=wp-content/uploads/link/to/file.jpg
everything is good, watermark is on the image, but when this image loads on the page or direct link in the browser - nothing happens. It loads original image without watermaks.
There is two main settings: htaccess rule
RewriteRule ^wp-content/uploads/(.*\.(jpe?g|gif|png))$ watermark.php?p=br&q=90&src=wp-content/uploads/$1
And full block of mod_rewrite section:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^wp-content/uploads/(.*\.(jpe?g|gif|png))$ watermark.php?p=br&q=90&src=wp-content/uploads/$1
</IfModule>
the php file is bigger and it's works as i see, the problem is in something else, but you can find the .php at the link on top of the post.
Whats the problem with me, or Apache, .htaccess or with Wordpress? If there is a way to deny any access to /uploads/ with possibility to open images throught php proxy – it is a solution also, but when i'm trying to use /wp-content/uploads/.htaccess with "deny from all" it wont work and the direct file is opens without any problems with browser.
UPDATE: The rule is not working even after the RewriteBase rule