If you are interested in discussing the implementation of this PHP script, please visit: our Drupal Watermark.php4 discussion forum.
![]() 1800getryan Homepage |
Drupal subsite |
<?php /* ============================================================================================= Script Name: watermark.php4 Verion: 1.0 Author: Ryan Doutt Date: April 2007 Acknowledge: Brock Ferguson - See original article at http://www.sitepoint.com/article/watermark-images-php 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 ^(.*)$ http://www.yourdomain.com/path/to/watermark.php4?src=$1 [NC] To see this script in action please point your favorite browser in the general direction of one of the following images: http://www.1800getryan.com/uploads/certaldo/P6180228.JPG http://www.1800getryan.com/uploads/ireland/P8230023.JPG http://www.1800getryan.com/uploads/broumov/P5240187.JPG 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);
imagecolortransparent($watermark,$white);
imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);
imagejpeg($image);
imagedestroy($image);
imagedestroy($watermark);?> |
If you are interested in discussing the implementation of this PHP script, please visit: our Drupal Watermark.php4 discussion forum.