<p>You need to loop through the assets as follows:</p>

<pre><code>{% for asset in block.memberPhoto %}
    &lt;img src="{{ asset.url }}" alt="{{ block.memberName }}" /&gt;
{% endfor %}
</code></pre>

<p>See <a href="https://craftcms.com/docs/assets-fields" rel="nofollow">https://craftcms.com/docs/assets-fields</a> for more info.</p>

CC BY-SA 3.0
2016-01-27T19:09:09.760Z
Instead of a loop it's way better for your page performance to use the `first` method to get the first asset. Only use a loop if there's multiple images.
carlcs
CC BY-SA 3.0
2016-01-27T19:10:24.050Z
Also see http://craftcms.stackexchange.com/questions/13401/impossible-to-invoke-a-method-on-a-null-variable
carlcs
CC BY-SA 3.0
2016-01-27T19:36:47.150Z
Ok great, Either one works. So I guess I will go with the first method for performance because there is only one photo per profile. Thanks!
Matthew Carleton
CC BY-SA 3.0
2016-01-27T18:44:14.607Z
2016-01-27T18:44:14.607Z
Ben Shoults
<p>First time working with Craft. I've got a Matrix field for team member profiles, title, name, image, etc.</p>

<p>I've got all the info pulled into the page but can't get the image. Here is my code, any help is appreciated!</p>

<pre><code>{% for block in entry.teamMember %} 
    &lt;figure class="team-item"&gt;
        &lt;img src="{{ memberPhoto.url }}" alt="{{ block.memberName }}" /&gt;

        &lt;figcaption class="team-item--info"&gt;
            &lt;h3&gt;{{ block.memberName }}&lt;/h3&gt;
            &lt;h4&gt;{{ block.memberTitle }}&lt;/h4&gt;
            &lt;h5&gt;hometown: {{ block.memberLocation }}&lt;/h5&gt;
        &lt;/figcaption&gt;
    &lt;/figure&gt;
{% endfor %}
</code></pre>

<templating><assets><matrix>
Images in Matrix field
# Images in Matrix field

(Asked by: username_0 on 2016-01-27)

First time working with Craft. I've got a Matrix field for team member profiles, title, name, image, etc.
I've got all the info pulled into the page but can't get the image. Here is my code, any help is appreciated!
{% for block in entry.teamMember %} 
    
        

        
            {{ block.memberName }}
            {{ block.memberTitle }}
            hometown: {{ block.memberLocation }}
        
    
{% endfor %}

**Tags:** templating, assets, matrix


---

## 1 answers

### Answer by username_1 on 2016-01-27. Score: 2 | Accepted answer

You need to loop through the assets as follows:
{% for asset in block.memberPhoto %}
    
{% endfor %}

See https://craftcms.com/docs/assets-fields for more info.

> **Comments:**
> **username_2**: Instead of a loop it's way better for your page performance to use the `first` method to get the first asset. Only use a loop if there's multiple images.  
> **username_2**: Also see http://craftcms.stackexchange.com/questions/13401/impossible-to-invoke-a-method-on-a-null-variable  
> **username_0**: Ok great, Either one works. So I guess I will go with the first method for performance because there is only one photo per profile. Thanks!  

---

