I'm trying to extend the image calls on a nested ImageDOM but it doesn't seem to be working.
Here is my Image Extension
<?php
class BlurImage extends Image {
function generateMainImage($gd) {
$gd->setQuality(80);
return $gd->resizeRatio(370,240);
}
function generateThumbImage($gd) {
$gd->setQuality(80);
return $gd->resize(120,80);
}
}
?>
Then my Nested Image DataObject
<?php
class ProdImage extends DataObject
{
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
'Category' => "Enum('Main, Product, HomeFeature')"
);
static $has_one = array (
'Product' => 'Product',
'Attachment' => 'File',
'Color' => 'Color',
'OImage' => 'BlurImage'
);
public function getCMSFields()
{
return new FieldSet(
new TextField('Name'),
new TextareaField('Description'),
new DropdownField('Category','Category', singleton('ProdImage')->dbObject('Category')->enumValues()),
new FileIFrameField('Attachment')
);
}
}
?>
When I call $OImage.MainImage.URL I should get a URL pointing to the Resized Image.
The only call that returns anything of note is $OImage.URL which returns the path to assets folder
Any Suggestions? Am I calling it wrong the wrong functions or have I attached it wrong to the DataObject