Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Image gallery - how to resize

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

Page: 1
Go to End
Author Topic: 927 Views
  • Trym
    Community Member
    18 Posts

    Image gallery - how to resize Link to this post


    I need to resize the images in my gallery before sending them to the client browser. The images have sizes of 500 kb (but resized only about 50 kb).

    I have in Page.php created a function
    function FrontPageRotator() {
    return DataObject::get("Image", "`ParentID` = 31");

    And in Page.ss the following template code
    <% if FrontPageRotator %>
    <% control FrontPageRotator %>
    <img class="frame" src="$Link" style="display:<% if First %>block;<% else %>none;<% end_if %>" width="270" height="220"/>
    <% end_control %>
    <% end_if %>

    I wanted to have $Image.setWidth(140) instead of $Link, but I dont seem to be able to refer to $Image.
    Can anyone help?

    Thanks in advance.

    Best regards Trym

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.