Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » resize by ratio?

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

Page: 1
Go to End
Author Topic: 1237 Views
  • janulka
    Avatar
    Community Member
    80 Posts

    resize by ratio? Link to this post

    Hello,

    In my template I would like to use image which will be resized by ratio, and I need to use "control" method to to that..

    e.g.
    <% control ResizedImage(150,150) %> - will resize image, skews if necessary
    <% control CroppedImage(150,150) %> - crops image

    what is the code for this to do resizing by ratio?

    thanks a lot in advance!

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: resize by ratio? Link to this post

    I presume that your images have a 1:1 relation to an object.

    <% control relationName %>
    $Image.SetRatioSize(80,80)
    <% end_control %>


    Have a look at the documentation:
    http://doc.silverstripe.org/doku.php?id=image

    1237 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.