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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

Thumbnail Image using SetRatioSize


Go to End


1353 Views

Avatar
rog

Community Member, 8 Posts

26 May 2011 at 10:56pm

I have been unable to get a thumbnail image for the function below. Maybe there is a better way to write it?

Page.php
...
function GetFiles() {
$id = $this->ID;
$obj = "FileAttach";
$filter = "ArticleID = $id";
$sort = "";
$join = "LEFT JOIN File ON (File.ID = FileAttach.FileID)";
$limit = "";
$data = DataObject::get($obj, $filter, $sort, $join, $limit);
return $data;
}
..

Page.ss
<% control GetFiles %>
$ID $Filename $File.URL // Works as you would expect it to and shows the ID, Filename and URL
$File.CMSThumbnail // Works and shows Icon and Link
$File.SetRatioSize(150,150) // Shows nothing
<% end_control %>