10375 Posts in 2190 Topics by 1707 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 519 Views |
-
Image_Gallery and watermark

2 October 2010 at 7:51am
Hi guys,
I'm looking for the best solution to add watermarks to my image gallery: http://ace.clickheredigital.co.uk/roofing-photo-gallery/
and my watermark is stored here: http://ace.clickheredigital.co.uk/themes/Ace/images/watermark.pngI've read all of the related threads on here (which look great) but im not much of a developer and don't really understand where I need to put the codes...
can anybody post a short tutorial for me?
im working with uncle cheese's Image_galleryANY help at all would be greatly appreciated.
-
Re: Image_Gallery and watermark

4 October 2010 at 11:37pm
do i do something like this
public function Watermark(GD $gd) {
// Read the watermark picture
$watermark = imagecreatefrompng($URL . '/themes/Ace/images/watermark.png');
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);// Read Full size Silverstripe image
$imageToWatermark = imagecreatefromjpeg($this->URL);// Calculate sizes
$size = getimagesize($this->URL);
$dest_x = $size[0] - $watermark_width - 5;
$dest_y = $size[1] - $watermark_height - 5;// Do transformations and save image in assets
imagecopymerge($imageToWatermark, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 40);
imagepng($imageToWatermark,$webroot . $this->filename . "_watermarked.png");
// And this is the trick ;-) Create an object Silverstripe can work with....
$GDoutput= new GD($webroot . $this->filename . "_watermarked.png");
return $GDoutput;
}where do i put this??
| 519 Views | ||
|
Page:
1
|
Go to Top |

