<p>I found the answer in a similar post here: <a href="https://craftcms.stackexchange.com/questions/16578/image-asset-url-is-not-being-output">Image asset url is not being output</a></p>

<p>My problem was with my Asset Source settings. Now that I think about it, it's obvious: I had no public URL declared for assets from my 'Uploads' source. Giving that a public url fixed the problem.</p>

<p>As I said, it's obvious now, but it'd be nice in the documentation could make even just a small reference to this.</p>

CC BY-SA 3.0
2016-08-31T16:58:42.910Z
2016-08-31T16:58:42.910Z
2017-04-13T12:51:00.303Z
Steven Thate
<pre><code>{% set image = entry.featuredImage.first() %}
{% if image %}
    &lt;img src="{{ image.url }}"/&gt;
{% endif %}
</code></pre>

CC BY-SA 3.0
2016-08-31T16:34:24.830Z
Thank you for your answer. I have tried this already, and it behaves the same. When I search the object returned by `dump(image)` there is no `url` key to be found. I can successfully return `{{ image.filename }}`, but no url!
Steven Thate
CC BY-SA 3.0
2016-09-01T08:14:08.167Z
For your answer to be as helpful as possible for the OP and others, it's always best to explain any code solutions and describe why the original code didn't work.
Luke Pearce
CC BY-SA 3.0
2016-08-31T16:30:48.363Z
2016-08-31T16:30:48.363Z
Harry Mee
<p>I'm a newcomer to Craft from the far-off lands of WordPress. I hope my stay is long and fruitful, but at the moment that prospect is in danger. The problem I'm having must be embarrassingly simple, but I can't find my way through it.</p>

<p>The simple task I am attempting to accomplish it to display an image I uploaded to an entry via a new asset field.</p>

<p>If there is a method or practice for displaying an image via asset fields found on the internet, I have tried it. Currently, this is how I am trying to render the image in my twig file:</p>

<pre><code>{% for image in entry.featuredImage %}
    &lt;img src="{{ image.url }}" alt="blah"&gt;
{% endfor %}
</code></pre>

<p>No image shows up.</p>

<p>When I <code>dump(image)</code>, should it be returning an array with 666 lines? I understand an asset returns a kind of Asset File Model (although I don't entirely understand <em>what</em> that means), but I find it hard to believe it's supposed to be that large.</p>

<p>Hoping to find at least the url of the asset, I perform <code>dump(image.url)</code>, but it only returns <code>bool(false)</code>. Why would it be doing that?</p>

<p>I created my <code>uploads</code> directory, and setup my asset source. I've tried doing this on an entirely fresh, up-to-date and clean install, but it still behaves the same way.</p>

<p>What am I missing or doing wrong?</p>

<p>Thank you!</p>

<templating><assets><url><field><image>
I am unable to correctly return the url of an uploaded asset
# I am unable to correctly return the url of an uploaded asset

(Asked by: username_0 on 2016-08-31)

I'm a newcomer to Craft from the far-off lands of WordPress. I hope my stay is long and fruitful, but at the moment that prospect is in danger. The problem I'm having must be embarrassingly simple, but I can't find my way through it.
The simple task I am attempting to accomplish it to display an image I uploaded to an entry via a new asset field.
If there is a method or practice for displaying an image via asset fields found on the internet, I have tried it. Currently, this is how I am trying to render the image in my twig file:
{% for image in entry.featuredImage %}
    
{% endfor %}

No image shows up.
When I dump(image), should it be returning an array with 666 lines? I understand an asset returns a kind of Asset File Model (although I don't entirely understand what that means), but I find it hard to believe it's supposed to be that large.
Hoping to find at least the url of the asset, I perform dump(image.url), but it only returns bool(false). Why would it be doing that?
I created my uploads directory, and setup my asset source. I've tried doing this on an entirely fresh, up-to-date and clean install, but it still behaves the same way.
What am I missing or doing wrong?
Thank you!

**Tags:** templating, assets, url, field, image


---

## 2 answers

### Answer by username_0 on 2016-08-31. Score: 5

I found the answer in a similar post here: [Image asset url is not being output](https://craftcms.stackexchange.com/questions/16578/image-asset-url-is-not-being-output)

My problem was with my Asset Source settings. Now that I think about it, it's obvious: I had no public URL declared for assets from my 'Uploads' source. Giving that a public url fixed the problem.

As I said, it's obvious now, but it'd be nice in the documentation could make even just a small reference to this.


---

### Answer by username_1 on 2016-08-31. Score: 0

{% set image = entry.featuredImage.first() %}
{% if image %}
    
{% endif %}

> **Comments:**
> **username_0**: Thank you for your answer. I have tried this already, and it behaves the same. When I search the object returned by `dump(image)` there is no `url` key to be found. I can successfully return `{{ image.filename }}`, but no url!  
> **username_2**: For your answer to be as helpful as possible for the OP and others, it's always best to explain any code solutions and describe why the original code didn't work.  

---

