I have a simple thing I would like to achieve, or at least I thought it was. This is the problem/challenge:

  1. My customer uploads images for sale to a WordPress site. All images other than the original one is set to be watermarked, but the original sized on is left intact. That's perfectly fine, probably.
  2. I've set download buttons for the original sized images to appear only for registered users, so that visitors won't have access to nothing but watermarked images. But the fact is that the non-watermarked, full resolution image is there for grabs, simply by heading to the adressbar wiping out the x-resolution-part of the filename. The watermarking is now more or less a complete waste of time.

I've looked for existing plugins high and low, but no watermarking plugins seems to have adressed this simple fact. Either you have to watermark everything, and leave the customers paying for images with some lovely paint-art all over their photo, or not watermark the full resolution image - and let everyone with just the slightest WordPress-skills pull down images for free.

How do I get past that? Is there a way to have the full resolution image follow some other naming pattern than the cropped ones? I've tried creating a second full sized image using add_image_size(), and then set the original full sized one to be watermarked, but with no luck. Rather obviously an identical image wont be created, since filenames would of course also be identical, which is impossible.

Any suggestions?


I figured out a sort of working solution, by using the plugin Image Watermark by dfactory.

The plugin has an option to back up all uploads, and by checking that in settings it uploads all your photos twice, with a backup in /wp-content/uploads/iw-backup/. What I did was enabling watermarking for all versions of the uploaded image, including the full one. And then let logged in users download the full resolution image from the backup-location. Not ideal, but at least the location isn't just as obvious.

For anyone wanting to do the same, I had to comment out one line in the plugin code to make it work. To protect the images the plugin creates a .htaccess file to keep them safe. Deleting it will make it work one time, untill it creates it once again.

Comment out line 138 in image-watermark.php to prevent that from happening:

file_put_contents( IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . '.htaccess', 'deny from all' );

To send the visitor to the correct location, you have to build the correct url. That will look something like:

$folder = wp_upload_dir();
echo $folder['baseurl'] . '/iw-backup' . $folder['subdir'] . '/' . $image['filename'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.