<p>Unless I'm misunderstanding the question, surely you'll need to use an IMG tag?</p>

<pre><code>{% for asset in assets %}
    &lt;img src="{{ asset.getUrl }}" /&gt;
{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-03-19T21:12:05.387Z
2015-03-19T21:12:05.387Z
Jamie Wade
<p>I'm confused about how to use an uploaded asset in a template (or rather why it isn't working).</p>

<p>1) I create an asset source and folder (Note: I did not add any fields).</p>

<p>2) I added this as a field in my entry fields called heroImage</p>

<p>3) I uploaded an asset to my single entry for the page.</p>

<p>4) I added this to the template</p>

<pre><code>{% for asset in entry.heroImage %}
             {{ asset.url() }}
             XXXX
{% endfor %}
</code></pre>

<p>5) I also tried</p>

<pre><code>    {% set assets = entry.heroImage %}
    {% if assets | length %}
      &lt;h3&gt;Some great assets&lt;/h3&gt;
      {% for asset in assets %}
          {{ asset.url }}
      {% endfor %}

    {% endif %}
</code></pre>

<p>I can see the image on the entry page but the template wont render it.</p>

<p>What could be </p>

CC BY-SA 3.0
2015-03-20T04:25:31.360Z
Does the template generate anything on the front end for #4?
Mark Busnelli Jr
CC BY-SA 3.0
2015-03-20T14:26:52.523Z
This was my mistake the issue was i was doing something else to change entry on the previous line...

    {% set entry = entry.otherThing.first() %}

Rookie...Can this be deleted?
Tim
<assets>
Using Asset Field in a Template
# Using Asset Field in a Template

(Asked by: username_0 on 2015-03-19)

I'm confused about how to use an uploaded asset in a template (or rather why it isn't working).
1) I create an asset source and folder (Note: I did not add any fields).
2) I added this as a field in my entry fields called heroImage
3) I uploaded an asset to my single entry for the page.
4) I added this to the template
{% for asset in entry.heroImage %}
             {{ asset.url() }}
             XXXX
{% endfor %}

5) I also tried
    {% set assets = entry.heroImage %}
    {% if assets | length %}
      Some great assets
      {% for asset in assets %}
          {{ asset.url }}
      {% endfor %}

    {% endif %}

I can see the image on the entry page but the template wont render it.
What could be

**Tags:** assets

> **Comments:**
> **username_1**: Does the template generate anything on the front end for #4?  
> **username_0**: This was my mistake the issue was i was doing something else to change entry on the previous line...      {% set entry = entry.otherThing.first() %}  Rookie...Can this be deleted?  

---

## 1 answers

### Answer by username_2 on 2015-03-19. Score: 4

Unless I'm misunderstanding the question, surely you'll need to use an IMG tag?
{% for asset in assets %}
    
{% endfor %}


---

