10389 Posts in 2200 Topics by 1712 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2011 Views |
-
ImageGallery and Watermark

22 July 2009 at 5:29am
Hello UncleCheese,
is there a way to extend the existing image gallery, oder even the image upload field to add a watermark to each photo when it has been uploaded? That would preserve me from much work, when this can be done in the process of uploading...
TIA
Markus Alexander -
Re: ImageGallery and Watermark

22 July 2009 at 5:42am
I'm sure there is. Plenty of sites do it, but it's complex work with the GD library. You might be able to find an open-source PHP class that does it for you.
-
Re: ImageGallery and Watermark

22 July 2009 at 10:54pm Last edited: 22 July 2009 10:55pm
did you search the forum ? I posted a (non-elegant) piece of code for that.....
-
Re: ImageGallery and Watermark

1 September 2009 at 11:17pm
Hey Fuzz10,
I am struggling to implement it into my website... I am wanting to make it add the watermark to all the large images (not the thumbnails)Do I add that function into the page control for the gallery page? or into the gd.php file?
How do I call it on the page?Thanks HEAPS for your help!
If you're too busy to explain it, if you just sent me the pages involved I'll be able to work the rest out
me@bradydyer.com
Cheers!
-
Re: ImageGallery and Watermark

2 September 2009 at 12:34am
Brady,
Basically , what you want to do is extend the Image class and use that class to add images to your pages.
For more information : check out
http://silverstripe.org/template-questions/show/256484
http://silverstripe.org/template-questions/show/256331
http://silverstripe.org/customising-the-cms/show/257710You can add the new watermark code to the image class as well..... Good luck !
-
Re: ImageGallery and Watermark

4 October 2010 at 11:37pm
can anybody shed any more light on this?
im struggling to work out where to actually put the code.im working with Uncle Cheese's Image_gallery.
do i apply the watermark when images are UPLOADED via the CMS, or is it when they are RENDERED?
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;
}
| 2011 Views | ||
|
Page:
1
|
Go to Top |




