6 times 9 Watermark
This is a project I created many years ago, and haven't touched in about 13 to 16 years. It's mainly here for posterity, but if you still find it useful (and if it still works) then by all means feel free to make use of it. Any references to "6 times 9" are because that is the retired website where I was previously hosting things like this.
A PHP script to add a watermark image to normal images (to identify the image's source) while keeping the location of the originals hidden, and without the need to manually photoshop the images to add the watermarks.
Once you have uploaded the script to the server, there are a couple of things to do before you use it.
Firstly create the watermark image. This can be done in your graphics package of choice, but the file must be a PNG. For example, this is my old "6 times 9" logo used in the Example section:
Secondly, edit the "Setup" section near the top of 6x9watermark.php:
$paddingis the number of pixels between the watermark and the outside of the image.
$watermarkis the path to watermark image, relative to the root directory. It must include the leading slash.
$pathis the path to 6x9watermark.php itself, relative to the root directory. It must include the leading and trailing slashes but must not include the actual filename.
After that you should be all set.
Once you've uploaded and set up the script, add:
<?php include '6x9watermark.php'; ?>
to the top of all pages where you want to use it. Obviously the pages must have a ".php" extension and the path in the "include" must match the actual location of the script.
Then, instead of this:
<img src="/path/to/image.jpg" alt="An Image" />
<img src="<?php echo watermark("/path/to/image.jpg"); ?>" alt="An Image" />
The path in the function must either be a full URL (http:// etc.) or the path to the image relative to the root directory of the website.
If the image or the watermark are not valid, then the image returned will be an image informing you of this fact, as in the Example section above.
To download 6 times 9 Watermark just right-click and choose "Save As" (or the equivalent for your device/web browser).