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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Stop people copying photos off site


Go to End


11 Posts   4169 Views

Avatar
Willr

Forum Moderator, 5523 Posts

29 August 2008 at 12:14pm

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

Community Member, 791 Posts

29 August 2008 at 6:40pm

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

Forum Moderator, 5523 Posts

29 August 2008 at 6:49pm

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

Go to Top