21310 Posts in 5739 Topics by 2604 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 189 Views |
-
ss 3.0.2 CMSThumbnail returns null

7 November 2012 at 1:23pm Last edited: 7 November 2012 1:52pm
I'm trying to show a thumbnail in summary gridfield.
static $has_many = array( 'Images' => 'Image');
static $summary_fields = array(
'Title' => 'Title',
'Thumb' => 'Thumb'
);public function getThumb()
{
if($this->Images()->count())
{
$image = $this->Images()->first();
return $image->CMSThumbnail();
}
else return "No images.";
}$image contains the correct Image object, but CMSThumbnail returns null, why?
Maybe I found the problem, but i can't solve it.
$image->Filename returns assets/{imageName}
Images are uploaded in 'assets/upload', but Silverstripe looks for them in assets. Why?
-
Re: ss 3.0.2 CMSThumbnail returns null

8 November 2012 at 12:37am
sorry I did not read the documentation carefully, the problem is due to relation 'has_many' for images. Changed to 'many_many' and seems to work properly.
| 189 Views | ||
|
Page:
1
|
Go to Top |

