I've got a Matrix field with an image. If I use a pre-defined transform that's defined in Assets everything works fine. However, I need to set a transform manually in the template but it keeps returning an error "The transform “wideCrop” cannot be found!". I have used transforms in templates all over the site that work fine so I'm puzzled why this particular one isn't working.

This is from an embedded template inside the entry:

{% for block in entry.contents %}
    {% for image in block.image %}          

        {% switch block.position %}
            {% case 'full' %}
                {% set wideCrop = { width: 940, height: 360, mode: 'fit' } %}
                <img class="full" src="{{ image.getUrl('wideCrop') }}">   
        {% endswitch %}

    {% endfor %}
{% endfor %} 

Thanks in advance!

1 Answer 1


Remove the single quotes around wideCrop.

<img class="full" src="{{ image.getUrl(wideCrop) }}"> 

Details for why the difference in "template defined" transforms here:

  • Thanks so much. I can't believe I missed the quote marks. Too much code, not enough sleep. :)
    – glider
    Commented Aug 15, 2016 at 23:32

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.