Jump to:

22983 Posts in 11709 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » Extending the GD Class

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

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

Page: 1
Go to End
Author Topic: 2034 Views
  • 181920
    Avatar
    Community Member
    8 Posts

    Extending the GD Class Link to this post

    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.

  • 181920
    Avatar
    Community Member
    8 Posts

    Re: Extending the GD Class Link to this post

    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?

    Attached Files
  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: Extending the GD Class Link to this post

    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 !

    2034 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.