in my watermark hack, i replaced only one line in functions.inc.php:
original code
return $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);
with this code
return 'logo.php?picturename='.$url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);
and here is the logo.php
<?
// SCHIPT BY DJ AXION
// e-mail: DJ@the-expansion.com
// Enjoy this script!
// GET SOURCE PICTURE FROM FORM INPUT
$b = imagecreatefromjpeg($picturename) or die ("Could not create from JPEG");
$bx = imagesx($b); // source width
$by = imagesy($b); // source height
$lm = $b;
if ($bx > 200 and $bx < 600 ) { // this ensures no watermark is added to small images (e.g. thumbnails)
// ADD WATERMARK (medium Image)
$pos = "bottomright"; //where is the watermark displayed...
if ($pos == "topleft") {
$src_x = 0;
$src_y = 0;
} else if ($pos == "topright") {
$src_x = $bx - 193;
$src_y = 0;
} else if ($pos == "bottomleft") {
$src_x = 0;
$src_y = $by - 187;
} else if ($pos == "bottomright") {
$src_x = $bx - 105;
$src_y = $by - 26;
}
// THIS IS THE CODE FOR THE WATERMARK
ImageAlphaBlending($lm, true) or die ("Could not alpha blend"); // Enable when on GD 2+
$logoImage = ImageCreateFromPNG('logo_small.png'); // logo.png is a watermark it add's...
$logoW = ImageSX($logoImage);
$logoH = ImageSY($logoImage);
ImageCopy($lm,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH);
}
if ($bx > 600) { // this ensures no watermark is added to small images (e.g. thumbnails)
// ADD WATERMARK (Big Image)
$pos = "bottomright"; //where is the watermark displayed...
if ($pos == "topleft") {
$src_x = 0;
$src_y = 0;
} else if ($pos == "topright") {
$src_x = $bx - 193;
$src_y = 0;
} else if ($pos == "bottomleft") {
$src_x = 0;
$src_y = $by - 187;
} else if ($pos == "bottomright") {
$src_x = $bx - 580;
$src_y = $by - 160;
}
// THIS IS THE CODE FOR THE WATERMARK
ImageAlphaBlending($lm, true) or die ("Could not alpha blend"); // Enable when on GD 2+
$logoImage = ImageCreateFromPNG('logo_big.png'); // logo.png is a watermark it add's...
$logoW = ImageSX($logoImage);
$logoH = ImageSY($logoImage);
ImageCopy($lm,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH);
}
Imagejpeg($lm,'',80); //80 means JPEG quality
imageDestroy($lm);
?>