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

error with 2.3.2-rc1 & getBannerImageRecursive()


Reply


2 Posts   803 Views

Avatar
patte

Community Member, 63 Posts

27 May 2009 at 12:11am

Hi,

I am using the receipe getBannerImageRecursive() mentioned in the SilverStripe Buch.

Updating SilverStripe to rc1 I get the following error uploading my BannerImage.

There has been an error
The website server has not been able to respond to your request.

class Page extends SiteTree {

   static $has_one = array(
      'BannerImage' => 'Page_BannerImage'
   );
   
   function getBannerImageRecursive() {
      $page = $this;
      $banner = $this->BannerImage();
      while(!$banner->ID && $page->ParentID != 0) {
         $page = $page->Parent();
         $banner = $page->BannerImage();
      }
      return $banner;
   }
   
   function getCMSFields() {
   $fields = parent::getCMSFields();   
   $fields->addFieldToTab('Root.Content.Header', new ImageField('BannerImage', 'Banner'));
   
   return $fields;
   }

}

class Page_BannerImage extends Image {
   
   function generateFullWidth($gd) {
      $gd->setQuality(80);
      return $gd->croppedResize(934,267);
   }

}

Does someone have an idea how to fix this?

Thanks much! Patte

Avatar
patte

Community Member, 63 Posts

27 May 2009 at 12:33am

hey guys,

I made a clean install (the third one) and now the error ist gone! Seems that the rc1 is a great release!

patte