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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

Extending the GD Class

Go to End

3 Posts   2589 Views


Community Member, 8 Posts

13 May 2009 at 4:52pm

Im still learning the ropes, but am really enjoying the flexiblity of Silverstripe, ive really tried to make use of what docs are available (although hard to find) to push the boundries of what i know. But this ones stumped me... I've found a very interesting PHP class that would add the exact functionality that i need to really push the GD class. Can anyone point me in the right direction, or add some pointers for including this class the correct silverstripe way? The class im wanting to include adds functionality such as blend modes and complex resizing etc.

I figured i should throw this out there to get some guidance before i dove in and broke something.

Cheers in advance.


Community Member, 8 Posts

14 May 2009 at 3:02pm

Edited: 14/05/2009 3:09pm

Can anyone point me in the right direction? im sure this would be of use to anyone who uses uploaded images on their silverstripe sites?

ive included the class and the Holder page im using it on. My thoughts are that its not returning what silverstripe expects. Does anyone know whats being returned after you run a generate***() image function, is it the image itself, or a class, or somethign else?


Community Member, 791 Posts

15 May 2009 at 12:10am

Well. It takes a bit more work to achieve what you want since S-stripe has the GD class wrapped which makes it easier to handle images with the SS framework.

I did not find an elegant method of doing this , so what I did was :

1> Get the image-location on disk of the Silverstripe image you'd like to process
2> Process the image with GD
3> Write the image to filesystem
4> Create a new Silverstripe_GD object to use in your template (To create a Silverstripe GD object, you can use
new GD(path/to/file) .....

Good luck !