title: How to watermark wordpress images from wp-content/uploads folder with htaccess and php?
body: <p>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.</p>
  
  <p>The solution is:
  <a href="http://dolcepixel.com/how-to-watermark-all-your-uploaded-images/" rel="nofollow">http://dolcepixel.com/how-to-watermark-all-your-uploaded-images/</a></p>
  
  <p>When i opening file with:</p>
  
  <p>/watermark.php?p=br&amp;q=90&amp;src=wp-content/uploads/link/to/file.jpg</p>
  
  <p>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.</p>
  
  <p>There is two main settings:
  htaccess rule</p>
  
  <pre><code>RewriteRule ^wp-content/uploads/(.*\.(jpe?g|gif|png))$ watermark.php?p=br&amp;q=90&amp;src=wp-content/uploads/$1
  </code></pre>
  
  <p>And full block of mod_rewrite section:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  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&amp;q=90&amp;src=wp-content/uploads/$1
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>