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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Extending 'Image' has broken 'files & Images'


Go to End


5 Posts   2453 Views

Avatar
Carbon Crayon

Community Member, 598 Posts

5 December 2008 at 3:24am

Edited: 05/12/2008 3:27am

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

Avatar
Willr

Forum Moderator, 5523 Posts

5 December 2008 at 11:07am

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

Avatar
Carbon Crayon

Community Member, 598 Posts

5 December 2008 at 12:33pm

Edited: 05/12/2008 12:38pm

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?

Avatar
Willr

Forum Moderator, 5523 Posts

5 December 2008 at 12:47pm

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

Avatar
Carbon Crayon

Community Member, 598 Posts

5 December 2008 at 3:05pm

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!