How to pull all images in [body] Matrix fields I'm working on a basic portfolio site wherein each entry or "project" has a body Matrix field with various blocks for various types of images. I'd like to make an index of all projects showing one slideshow/carousel for each project containing all images within that project.

The problem is that I don't know how to query all images at once = All images, all blocks, in the order they appear in the entry.

Here's my specific code in use. It's almost there but due to the 0 in image[0] it's only pulling in the first image from each instance of each Matrix Block. For example, there are two instances of the block called imageHalf and it pulls the first image from each.

I don't understand how to avoid this integer....

{% for block in entry.body %}

{% switch block.type %}

{% case "imageFull" %}

{% set image = block.image.total() %}

    &lt;a href="{{ entry.url }}"&gt;&lt;img data-lazy="
        {{ block.image[0].getUrl() }}
    " /&gt;&lt;/a&gt;

{% case "imageHalf" %}

    &lt;a href="{{ entry.url }}"&gt;&lt;img data-lazy="
        {{ block.image[0].getUrl() }}
    " /&gt;&lt;/a&gt;

{% case "imageCouple" %}

    &lt;a href="{{ entry.url }}"&gt;&lt;img data-lazy="
        {{ block.image[0].getUrl() }}
    " /&gt;&lt;/a&gt;

{% endswitch %}

{% endfor %}
I think you need to use a {% switch %} statement like the following:

{% switch matrixBlock.type %}

{% case "text" %}

    {{ matrixBlock.textField | markdown }}

{% case "image" %}

    {{ matrixBlock.image[0].getImg() }}

{% default %}

    &lt;p&gt;A font walks into a bar.&lt;/p&gt;
    &lt;p&gt;The bartender says, “Hey, we don’t serve your type in here!”&lt;/p&gt;
{% endswitch %}


You can read more here: http://buildwithcraft.com/docs/templating/switch