How to have beautiful watermarks in elgg?

 

 

 

One question ., what will be the code to place in the watermark.php to acheive above effect of watermark.,

Just need contrasting background with text over it so that its below image and is visible too.

Also need the watermark to be permanent as present plugin dont show watermark in downloaded image.

Below is the riginal code., Unable to attain this after several attempts.

// plugins can do their own watermark and return false to prevent this function from running

if (trigger_plugin_hook('tp_watermark', 'gd', $image, true) === false)

return;

 

global $CONFIG;

 

$owner = get_loggedin_user();


$watermark_text = tp_process_watermark_text($watermark_text, $owner);

 

// transparent gray

imagealphablending($image, true);

$textcolor = imagecolorallocatealpha($image, 50, 50, 50, 60);

 

// font and location

$font = $CONFIG->pluginspath . "tidypics/fonts/LiberationSerif-Regular.ttf"; 

$bbox = imagettfbbox(20, 0, $font, $watermark_text);

 

$text_width = $bbox[2] - $bbox[0];

$text_height = $bbox[1] - $bbox[7];

 

$image_width = imagesx($image);

$image_height = imagesy($image);

 

$left = $image_width / 2 - $text_width / 2;

$top = $image_height - 20;

 

// write the text on the image

imagettftext($image, 20, 0, $left, $top, $textcolor, $font, $watermark_text);

}


function tp_imagick_watermark($filename) {


$watermark_text = get_plugin_setting('watermark_text', 'tidypics');

if (!$watermark_text)

return;