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.

Template Questions /

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

Thumbnail Image using SetRatioSize


Go to End


1771 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 %>