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.

Template Questions /

resize by ratio?


Reply


2 Posts   1267 Views

Avatar
janulka

Community Member, 80 Posts

30 December 2009 at 10:39am

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!

Avatar
baba-papa

Community Member, 279 Posts

1 January 2010 at 4:44am

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