HTACCESS Wrappers with PHP - A practical way...
(Page 7 of 9 )
A practical way to keep this from happening is to add a watermark to all your images, which is your logo or name on a corner somewhere, forcing anyone who takes your graphic to either unwillingly give you credit, or chop off a part of that picture.
Lucky for us, PHP has a set of functions to handle images, and in version 4.3 and above, it's included by default. Wrappers come in handy here because you might have an entire site full of images and would rather not spend three weeks watermarking tons of images by hand. Maybe you just don't want to have to juggle two sets of images, one watermarked and one normal.
Download this script from: http://www.jumpx.com/tutorials/wrapper/watermark.zip
The only files you need to worry about in that zip are htaccess.txt and wrapper.php. Upload them to a folder called "watermark", chmod htaccess.txt to 0755 and rename to ".htaccess".
The file wrapper.php remain as is. I've put comments in the file regarding most of what it does, so if you're curious go ahead and take a peek.
What the script does is this: It figures out the original image that was supposed to be called. Then it loads the watermark, which I've set in wrapper.php to be "watermark.png" which is just a PNG image containing the text "THIS IS WATER MARKED". The watermark is placed on top of the original, in the lower right corner, and output in the same format (i.e., JPEG) as the original.
You can tell the difference by looking at these two images:
More Web Development Articles
More By 359