6 times 9 Watermark

This is a project I created many years ago, and haven't touched in about 10 to 13 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.

About

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.

Example

Pebbles
The original "Pebbles" image, from Flickr, without any watermark.
Watermarked Pebbles
The "Pebbles" photo, now with the logo from my old "6 times 9" website as a watermark.
Invalid Image
The warning when an invalid image has been used.
Invalid Watermark
The error when the watermark is not a valid image.

Using

Initial Setup

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:

6 times 9 Logo

Secondly, edit the "Setup" section near the top of 6x9watermark.php:

  • $padding is the number of pixels between the watermark and the outside of the image.
  • $watermark is the path to watermark image, relative to the root directory. It must include the leading slash.
  • $path is 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.

Implementation

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" />

do this:

<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.

Invalid Images

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.

Download

To download 6 times 9 Watermark just right-click and choose "Save As" (or the equivalent for your device/web browser).

Last updated: (version "Alpha")