Watermark Uploads

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
RedSpider
Posts: 36
Joined: Jan 30, 2015 2:47 pm

Watermark Uploads

Post by RedSpider »

Wondering if it's possible to have a plugin to add a small watermark onto uploaded images, maybe include the following info:

Site Name / Project Name
Bug ID / Name
Optional Logo

be happy to make a small donation if anyone can knock this together :)

mayya17
Posts: 1
Joined: May 05, 2017 4:08 am

Re: Watermark Uploads

Post by mayya17 »

I was trying to use and change this code, but i'm new to PHP... isn't work...

Code: Select all

<?
$SourceFile = ' ';
$DestinationFile = ' ';
$WaterMarkText = 'Copyright text goes';
watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile);

function watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile) {
list($width, $height) = getimagesize($SourceFile);
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($SourceFile);
$left = ($width / 10) ;
$top = ($height / 4) ;
$bot = ($top * 2) ;
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height);
$black = imagecolorallocatealpha($image_p, 255, 255, 255, 50);
$font = 'arial.ttf';
$font_size = 120;
imagettftext($image_p, $font_size, 0, $left, $bot, $black, $font, $WaterMarkText);
$left = ($width / 16) ;
$top = ($height / 6) ;
$bot = ($top * 2) ;
$grey= imagecolorallocate($image_p, 128, 128, 128);
imagettftext($image_p, $font_size, 0, $left, $bot, $grey, $font, $WaterMarkText);
$left = ($width / 16) ;
$top = ($height / 3) ;
$bot = ($top * 2) ;
$grey= imagecolorallocate($image_p, 128, 128, 128);
imagettftext($image_p, $font_size, 0, $left, $bot, $grey, $font, $WaterMarkText);
if ($DestinationFile<>'') {
imagejpeg ($image_p, $DestinationFile, 100);
} else {
header('Content-Type: image/jpeg');
imagejpeg($image_p, null, 100);
};
imagedestroy($image);
imagedestroy($image_p);
};
?>
Find Erykah Badu Tickets and concert schedule. Cheapest tickets are available now.

Post Reply