Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Stop people copying photos off site


Reply

11 Posts   3265 Views

Avatar
Willr

29 August 2008 at 12:14pm Forum Moderator, 5511 Posts

Well you best to explain GD then wikipedia - http://en.wikipedia.org/wiki/GD_Graphics_Library. But put simply its a way of editing / creating / tweaking images from your code.

The silverstripe installer checks for GD2 when you install so unless you had an error when you installed you should be fine.

- Fuzz10 as to how to implement it is how your method was written. Does it save a copy of the image some where or just override the original? And also how are you uploading the images? Do you want to add the water mark to the images in the content area or are you using an upload form?. The best way would probably be to define doPublish() on your page class. and have something like

class Page extends SiteTree {
....
...
// this fires when you hit publish
function doPublish() {
$this->AddWaterMarksToImages();
return parent::doPublish()
}


So when you publish a page it runs off and does your water marking method.

Avatar
Fuzz10

29 August 2008 at 6:40pm Community Member, 787 Posts

Thanks for your reply.

The problem I´m having has more to do with the fact that I cannot figure out how to use the PHP GD library to work the imagedata contained in the silverstripe image. In order for me to watermark the image , I need to be able to get the raw (GD) data out of the Silverstripe object, change it , and then place it back .. Right ?

Avatar
Willr

29 August 2008 at 6:49pm Forum Moderator, 5511 Posts

check out the http://api.silverstripe.com/sapphire/filesystem/GD.html class. you could create a new GD object with the filename as the constructor and knock yourself out