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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

GD class question


Go to End


3 Posts   1512 Views

Avatar
dynamite

Community Member, 66 Posts

1 October 2009 at 10:26am

Hello,

I wold like to merge two GD images together. Anyone else tried something similar? Or anyone else have some ideas? I looked at the API documentation but didn't see anything that could do that.

Thanks!

Jeremy

Avatar
bummzack

Community Member, 904 Posts

1 October 2009 at 10:53am

Edited: 01/10/2009 10:54am

Hi

It's certainly doable. The SilverStripe GD class is just a wrapper around the PHP GD functionality (http://php.net/manual/en/ref.image.php). You can do a lot using these functions. If you're doing per-pixel operations, prepare for a performance hit though (at least when processing larger images).
You can create a subclass of the SilverStripe GD class where you implement the desired functionality. Then create a subclass of the Image class and override generateFormattedImage (to use your custom GD class instead of the default one). You can also implement different custom generate methods to use them in your templates (http://doc.silverstripe.com/doku.php?id=recipes:customising_image).

Avatar
dynamite

Community Member, 66 Posts

1 October 2009 at 1:29pm

Cool, thanks for the info! I will try it out.