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.

General Questions

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

Custom Site Config Issue with Extended Image Class


Reply

2 Posts   1138 Views

Avatar
nimeso

28 September 2010 at 12:59pm Community Member, 17 Posts

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

Avatar
Sean

28 September 2010 at 7:55pm Forum Moderator, 921 Posts

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