Use Firesize to super-quickly resize images on the fly, with built-in CDN.
Note: The Firesize service was shut down together with the Assembly community. I will leave this for future reference.
<h2>Image url</h2>
{{ craft.firesize.url('http://i.imgur.com/hHpJscb.png') }}
or
{% set url = craft.firesize.url({
url : 'http://i.imgur.com/hHpJscb.png',
width : 400,
height : 200,
crop: false,
format: 'jpeg'
}) %}
<img src="{{ url }}" />
<h2>Image tag</h2>
{{ craft.firesize.img({
url: 'http://i.imgur.com/hHpJscb.png',
width: 480,
height: 240,
crop: 'left'
alt: 'Lorem ipsum',
class: 'image-class'
}) }}
Option | Description |
width | Image width (will resize proportionally if only one dimension is specified.) |
height | Image height |
crop | Supported values are: top, top-left, top-right, center, left, right, bottom, bottom-left, bottom-right, none/false |
format | Convert to format. Supported values are: png, jpg, jpeg, gif |
frame | If the image file has multiple frames/layers, like a animated gif or PSD for instance, only the frame with the index specified will be selected. |
If using the img method, you can also set these options | |
alt | Sets the alternative text for the img tag |
class | Set class attribute |