TWIG: Crop Image of Collection

I have a page collection that provides an image in the collection header (has been uploaded through the admin panel directly to the page). I want to cropResize() this image but I do not get it to work. My code:

{% for product in categ.collection %}
{% set prdimage = product.media.images[product.header.image] %}
{{prdimage.cropResize(100,100).html()}}
{% endfor %}

returns nothing. any ideas?

Looks like there are missing the single quotes around product.header.image

{% set prdimage = product.media.images['product.header.image'] %}

https://learn.getgrav.org/content/media#url

Also, try dumping those variables to the debug bar to check if product is actually something, and same for product.media.images and prdimage

sorry for my late reply. wsanter’s answer FTW :slight_smile: