Page 1 of 1
Watermark
Posted: Fri Apr 27, 2007 8:16 am
by Holger
Hi,
I have the watermark-addon installed, but I cannot find the instructions anymore.
Can anybody post them or direct me to the instructions?
Thank you!
/Holger
Posted: Thu May 03, 2007 7:45 am
by Holger
Nobody?

Posted: Thu May 03, 2007 3:49 pm
by DavidIQ
Where did you get the add-on from? This is the first time I hear of such a thing for attachment mod.
Posted: Fri May 04, 2007 3:19 am
by Holger
Hi David,
I got it on the opentools-site from the user "Morpheus".
In posting_attachments.php
After
Code: Select all
$this->post_attach = FALSE;
}
}
}
I have
Code: Select all
//
// Function modificated by Morpheus to add support for other kind of images
//
//$filename should be a JPG and $watermark a PNG-24 with alpha transparency. $quality is 1-100 JPG quality on output.
function watermark($srcfilename, $newname, $watermark, $quality, $extension)
{
$imageInfo = getimagesize($srcfilename);
$width = $imageInfo[0];
$height = $imageInfo[1];
$logoinfo = getimagesize($watermark);
$logowidth = $logoinfo[0];
$logoheight = $logoinfo[1];
$horizextra = $width - $logowidth;
$vertextra = $height - $logoheight;
$horizmargin = round($horizextra);
$vertmargin = round($vertextra);
switch(trim(strtolower($extension)))
{
case "gif" :
$photoImage = ImageCreateFromGIF($srcfilename);
break;
case "jpeg" :
case "jpg" :
$photoImage = ImageCreateFromJPEG($srcfilename);
break;
case "png" :
$photoImage = ImageCreateFromPNG($srcfilename);
break;
case "bmp":
$photoImage = ImageCreateFromwBMP($srcfilename);
break;
}
ImageAlphaBlending($photoImage, true);
$logoImage = ImageCreateFromPNG($watermark);
$logoW = ImageSX($logoImage);
$logoH = ImageSY($logoImage);
ImageCopy($photoImage, $logoImage, $horizmargin, $vertmargin, 0, 0, $logoW, $logoH);
//ImageJPEG($photoImage); // output to browser
switch(trim(strtolower($extension)))
{
case "gif" :
ImageGIF($photoImage, $newname, $quality);
break;
case "jpeg" :
case "jpg" :
ImageJPEG($photoImage, $newname, $quality);
break;
case "png" :
ImagePNG($photoImage, $newname, $quality);
break;
case "bmp" :
ImagewBMP($photoImage, $newname, $quality);
break;
default :
break;
}
ImageDestroy($photoImage);
ImageDestroy($logoImage);
}
and
After
Code: Select all
global $error, $error_msg, $lang, $upload_dir;
I have
Code: Select all
// if ( $attach_config['watermark_active'] )
// {
switch( $this->extension )
{
case "gif" :
case "jpg" :
case "jpeg" :
case "png" :
case "bmp" :
// $watermark = $attach_config['watermark_img'];
$watermark = "album_mod/mark.png";
// $quality = $attach_config['watermark_quality'];
$quality = "75";
$this->watermark($file, $file, $watermark, $quality, $this->extension);
break;
default :
break;
}
// }
That is not everything ... I am afraid.
/Holger
Posted: Fri May 04, 2007 7:41 am
by DavidIQ
Try looking through this:
http://www.opentools.de/archive/index.php?t=2599
Looks like you'll have to put together some code and see what works...
Posted: Fri May 04, 2007 7:52 am
by Holger
Thank you!
On pages 5 and 6 there is the solution!
/Holger