top of page

PHP Watermark

Updated: Aug 14, 2020




Script Name: watermark.php4

Verion: 1.0

Author: Ryan Doutt

Date: April 2007

Acknowledge: Brock Ferguson - See original article at

which this script is based.

This is a PHP scripted, watermarking system for graphics files to be used with .htaccess on

an Apache web server. It should be called as follows from within your root .htaccess file:

RewriteEngine on

RewriteCond %{REQUEST_URI} uploads(.*) [NC]

RewriteRule ^(.*)$$1 [NC]

To see this script in action please point your favorite browser in the general direction of

one of the following images:

This script is available for use as freeware subject to the retention of the preceding

information and acknowledgements in any copy or modification that is made to this code.



header('content-type: image/jpeg');

$watermark = imagecreatefrompng('watermark.png');

$watermark_width = imagesx($watermark);

$watermark_height = imagesy($watermark);

$image = imagecreatefromjpeg($_GET['src']);

$size = getimagesize($_GET['src']);

$dest_x = $size[0] - $watermark_width;

$dest_y = $size[1] - $watermark_height;

$white = imageColorAllocate ($watermark, 255, 255, 255);


imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);





9 views0 comments

Recent Posts

See All

PHP Thumbnail

<?php /* ============================================================= Script Name: thumbnail.php Version: 2.0 Author: Ian Anderson Date: January 2007 Acknowledge: Teekai -

PHP Random Image

<?php /* ============================================================= Script Name: randomimage.php4 Verion: 2.0 Author: Ryan Doutt Date: January 2007 Acknowledge: Ian Anderson - See modification at h


T. B.
bottom of page