Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Extending 'Image' has broken 'files & Images'

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1639 Views
  • Aram
    Avatar
    Community Member
    598 Posts

    Extending 'Image' has broken 'files & Images' Link to this post

    Hi guys

    I have extended the image class so that I can use custom GD resizing but it seems to have broken my files & images section in the CMS which brings up the following error:

    Fatal error: Class 'DailyImage' not found in C:\wamp\www\silverstripeSDE\sapphire\filesystem\Folder.php on line 107

    The code which extends image is in Page.php and reads:

    class DailyImage extends Image {
    function generateThumbnailImage($gd) {
    $gd->setQuality(75);
    return $gd->croppedResize(178,105);
    }
    }

    I had a look in Folder.php but cant figure out whats going on :S
    any ideas?

    Thanks in advance

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: Extending 'Image' has broken 'files & Images' Link to this post

    Have you done a DB build?. You might also need to make sure that class is in a seperate file eg DailyImage.php so SS can pick up that class

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Extending 'Image' has broken 'files & Images' Link to this post

    perfect thanks Willr, it needed to go into its own file.

    I will correct the tutorial in the docs that said to put it in Page.php

    thanks for your help

    EDIT: hmmm how would I go about editing the docs for this? Am I wrong in thinking its like the wiki where anyone can edit? I can't seem to edit with my forum login....do I need a special login?

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: Extending 'Image' has broken 'files & Images' Link to this post

    Yes the wiki + open.silverstripe.com both use different login systems to the forum. You can register at http://doc.silverstripe.com/doku.php?id=start&do=register

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Extending 'Image' has broken 'files & Images' Link to this post

    OK I know why this was going wrong, if you want to include the image extention class inside Page.php then it needs to be in the form PageName_Classname so in my example it would need to be called 'Page_DailyImage'. Otherwise it needs to go into its own file.

    I have added another line to the description on this page to make this clear: http://doc.silverstripe.com/doku.php?id=imageupload

    thanks for your help willr!

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