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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Custom Site Config Issue with Extended Image Class


Go to End


2 Posts   1515 Views

Avatar
nimeso

Community Member, 17 Posts

28 September 2010 at 12:59pm

Hi all,

This is crashing my Apache server when I call a method on the ExtendedImage class from a template... thoughts?

------------ CustomSiteConfig.php -------------

<?php
class CustomSiteConfig extends DataObjectDecorator {

function extraStatics() {
return array(
'db' => array(

),

'has_one' => array(
'BannerImage' => 'ExtendedImage',
'SectionImage' => 'ExtendedImage'
)
);
}

public function updateCMSFields(FieldSet &$fields) {
$fields->addFieldToTab("Root.Main", new ImageField("BannerImage", "Default Banner Image"));
$fields->addFieldToTab("Root.Main", new ImageField("SectionImage", "Default Section Image"));
}
}
?>

---------- ExtendedImage.php ------------------------------------

<?php
class ExtendedImage extends Image {

function generateSmallBanner($gd) {
$gd->setQuality(100);
return $gd->croppedResize(940,230);
}
}
?>

-----------------------------------------------------------------------

We are having this problem on both local and live servers.

Cheers
Jamie

Avatar
Sean

Forum Moderator, 922 Posts

28 September 2010 at 7:55pm

You'll have to provide more detail. When you say "crashing my Apache server", what are the conditions in that it occurs?

Try checking the Apache logs to see if there's anything in there.

Cheers,
Sean