Matrix gallery with Imager plugin I have a portfolio page for a client that has a simple two column grid of images. However, I'd like to set it up so that it creates responsive images via the excellent Imager plugin.

I have the following code below so far. However, it's only outputting the first image from the Matrix. So I need it to output all the images the client drops in.

So need a little bit of help to tweak the code to output all images please?

{% for block in entry.portfolio %}
    {% switch block.type %}

    {% case "images" %}
    {% set image = block.portfolioImage.first() %}
    {% set transformedImages = craft.imager.transformImage(image,
      [
          { width: 1200, ratio: 4/3 },
          { width: 992, ratio: 4/3 },
          { width: 768, ratio: 4/3, jpegQuality: 60 },
      ],
      {
          format: 'jpg',
          allowUpscale: false,
          mode: 'crop',
          jpegQuality: 80,

          interlace: true
      }
    ) %}
    {% if image | length %}
    &lt;img class="img-responsive"
         src="{{ transformedImages[1].url }}"
         sizes="50vw"
         srcset="{{ craft.imager.srcset(transformedImages) }}"
         alt="{{ image.title }}"&gt;
    {% endif %}

    {% endswitch %}
{% endfor %}
Assuming it's the field portfolioImage that can have multiple assets, try this:

{% for block in entry.portfolio %}
    {% switch block.type %}

    {% case "images" %}

    {% for image in block.portfolioImage %}
        {% set transformedImages = craft.imager.transformImage(image,
            [
                { width: 1200, ratio: 4/3 },
                { width: 992, ratio: 4/3 },
                { width: 768, ratio: 4/3, jpegQuality: 60 },
            ],
            {
                format: 'jpg',
                allowUpscale: false,
                mode: 'crop',
                jpegQuality: 80,
                interlace: true
            }
        ) %}
        &lt;img class="img-responsive"
             src="{{ transformedImages[1].url }}"
             sizes="50vw"
             srcset="{{ craft.imager.srcset(transformedImages) }}"
             alt="{{ image.title }}"&gt;
    {% endfor %}

    {% endswitch %}
{% endfor %}