PHP snippet to Watermark Images Automatically.

This snippet brings a one line .htaccess, if you choose to use it, any call to a image on your website, gets automatically watermarked, stopping anyone from downloading the image without the watermark.

You can also center the watermark in the following ‘variable name‘ positions:

  • TOP_LEFT , TOP_CENTER, TOP_RIGHT
  • CENTER_LEFT, CENTER, CENTER_RIGHT
  • BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT

You can either change the default settings in the .php file, or if you invoke the script direct directly you can pass parameters either in .htaccess or in a html page, as you can see in the demo.

The scripts uses two merging type functions (imagecopy and imagecopymerge).
In case you already have a .PNG or .GIF with the opacity set, you can set the script to just overlay it, otherwise if you use a JPEG or any other file without transparency set, you can choose the opacity and the script will merge it accordingly.

You can find the code over at github. You can find a Demo here.

Enjoy.

Comments to "PHP Automatic Image Watermark"

  1. wapy

    April 15, 2013

    Woah! This is really cool and comes in handy, I must give it a try :3

Would you like to share your thoughts?