This page last changed on Jun 14, 2012 by jed.wheeler@involver.com.

resize_to

This filter allows you to dynamically resize an Involver hosted image or crop it to square on the server side.


Examples

Let's use the Flickr feature block as an example:

Resize the larger dimension, maintaining the aspect ratio

{% flickr name:"foo" %}
  <h2>Photos For Flickr User: {{flickr.flickr_username}}</h2>
  <ul>
  {% for image in flickr.images %}
     <li>{{image.title}} - {{ image.default_image.cached_url | resize_to: '200' | img_tag:image.title }} </li>
  {% endfor %}
  </ul>
{% endflickr %}

Crop the image to a square, maintaining the aspect ratio

{% flickr name:"foo" %}
  <h2>Photos For Flickr User: {{flickr.flickr_username}}</h2>
  <ul>
  {% for image in flickr.images %}
     <li>{{image.title}} - {{ image.default_image.cached_url | resize_to:'square' | resize_to: '200' | img_tag:image:title }}</li>
  {% endfor %}
  </ul>
{% endflickr %}

FAQ

  1. What kind of special crops are available?
    Currently, the only special cropping option available is 'square', which maintains the aspect ratio and expects only a single image dimension.

    Related Topics

Document generated by Confluence on Feb 12, 2013 09:09