Jump to:

23375 Posts in 18175 Topics by 2866 members

General Questions

SilverStripe Forums » General Questions » error with 2.3.2-rc1 & getBannerImageRecursive()

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: 762 Views
  • patte
    Avatar
    Community Member
    63 Posts

    error with 2.3.2-rc1 & getBannerImageRecursive() Link to this post

    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

  • patte
    Avatar
    Community Member
    63 Posts

    Re: error with 2.3.2-rc1 & getBannerImageRecursive() Link to this post

    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

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