How can I output a resized Assets image in a single entry template? I'm trying to do what I used to do all the time with CE Image in EE. I'm hoping that I don't have to create an image transform in the CP for every single piece of image resizing that I want to do as that would be very time consuming (compared to using the CE Image parameters for width and height in EE).

Here's my current code:

{% for asset in entry.mainImage %}
  <img src="{{ asset.url }}" alt="{{ asset.title }}" />
{% endfor %}

And for EE users, here's what I'm trying to replicate from EE:

  {exp:ce_img:single src="{url}" width="800" height="600" alt="{alt_text}"}

Thanks for any help in advance.

Update: Here's what my final code looked like after following the example in the link provided by Brad below:

{% set thumb = {
  mode: 'fit',
  width: 800,
  height: 600,
  quality: 80
} %}

{% for asset in entry.mainImage %}
  <img src="{{ asset.getUrl(thumb) }}" alt="{{ asset.title }}" />
{% endfor %}

1 Answer 1


You can dynamically create and specify transform parameters from your templates to achieve what you're looking for. See here for an example.

  • Thanks for this Brad. I've updated my question with what my final code ended up like after checking out that example.
    – Stephen
    Commented Jan 20, 2015 at 0:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.