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.

Archive

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

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

Extending 'Image' has broken 'files & Images'


Reply

5 Posts   1664 Views

Avatar
Carbon Crayon

5 December 2008 at 3:24am (Last edited: 5 December 2008 3:27am), Community Member, 598 Posts

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

5 December 2008 at 11:07am Forum Moderator, 5511 Posts

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

5 December 2008 at 12:33pm (Last edited: 5 December 2008 12:38pm), Community Member, 598 Posts

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

5 December 2008 at 12:47pm Forum Moderator, 5511 Posts

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

5 December 2008 at 3:05pm Community Member, 598 Posts

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: [url]http://doc.silverstripe.com/doku.php?id=imageupload[/url]

thanks for your help willr!