Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Custom Site Config Issue with Extended Image 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: 1131 Views
  • nimeso
    Avatar
    Community Member
    17 Posts

    Custom Site Config Issue with Extended Image Class Link to this post

    Hi all,

    This is crashing my Apache server when I call a method on the ExtendedImage class from a template... thoughts?

    ------------ CustomSiteConfig.php -------------

    <?php
    class CustomSiteConfig extends DataObjectDecorator {
       
       function extraStatics() {
          return array(
             'db' => array(

             ),
             
             'has_one' => array(
                'BannerImage' => 'ExtendedImage',
                'SectionImage' => 'ExtendedImage'
             )
          );
       }

       public function updateCMSFields(FieldSet &$fields) {
          $fields->addFieldToTab("Root.Main", new ImageField("BannerImage", "Default Banner Image"));
          $fields->addFieldToTab("Root.Main", new ImageField("SectionImage", "Default Section Image"));
       }
    }
    ?>

    ---------- ExtendedImage.php ------------------------------------

    <?php
    class ExtendedImage extends Image {

       function generateSmallBanner($gd) {
          $gd->setQuality(100);
          return $gd->croppedResize(940,230);
       }
    }
    ?>

    -----------------------------------------------------------------------

    We are having this problem on both local and live servers.

    Cheers
    Jamie

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Custom Site Config Issue with Extended Image Class Link to this post

    You'll have to provide more detail. When you say "crashing my Apache server", what are the conditions in that it occurs?

    Try checking the Apache logs to see if there's anything in there.

    Cheers,
    Sean

    1131 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.