Jump to:

3447 Posts in 1032 Topics by 872 members

Template Questions

SilverStripe Forums » Template Questions » Thumbnail Image using SetRatioSize

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

Page: 1
Go to End
Author Topic: 865 Views
  • rog
    Avatar
    Community Member
    8 Posts

    Thumbnail Image using SetRatioSize Link to this post

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

    865 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.