<p>So after looking through other craft websites to see how they where able to get images to work I discovered what I did wrong when setting up the asset source. The thing is though that the craft documentation is not very helpful in this regard, also there are no errors or helpful output to indicate that my configuration might be the issue.</p>

<p><a href="https://i.sstatic.net/yhllh.png" rel="noreferrer"><img src="https://i.sstatic.net/yhllh.png" alt="What I needed to do"></a></p>

CC BY-SA 3.0
2016-08-30T22:48:19.353Z
2016-09-05T05:38:03.913Z
2016-09-05T05:38:03.913Z
Matthew
<p>After going through the documentation I believe that this is the correct code to output the url for the asset field but its not working and I have no idea why. Please help!</p>

<pre><code>{% nav program in craft.entries.section('program').level(1) %}
  {% set active = entry is defined and program.isAncestorOf(entry) %}

  &lt;div class="{% if active %}active{% endif %}"&gt;
      {% if program.featureImage|length %}
        &lt;img src="{{ program.featureImage.first().url }}" alt="{{ program }}"&gt;
      {% endif %}
      &lt;h3 href="{{ program.url }}"&gt;{{ program.title }}&lt;/h3&gt;
      &lt;p&gt;{{ program.description }}&lt;/p&gt;
  &lt;/div&gt;

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

CC BY-SA 3.0
2016-08-30T05:46:44.623Z
That looks correct. Are the other variables such as `program.url` and `program.title` working? What value do you get when outputting `program.featureImage|length`?
Fyrebase
CC BY-SA 3.0
2016-08-30T05:59:18.040Z
`program.url` and `program.title` are both working as intended they output the correct data. I get a value of `1` when outputting `program.featureImage|length` by itself. Its a really wierd cause everything indicates that it should just output the image url
Matthew
CC BY-SA 3.0
2016-08-30T06:05:49.200Z
I have just included the output of when i do a dump on `program.featureImage`
Matthew
CC BY-SA 3.0
2016-08-30T06:09:27.543Z
What does `{{ program.featureImage.first.filename }}` output?
Fyrebase
CC BY-SA 3.0
2016-08-30T06:31:35.323Z
When I try that i get the following error `Impossible to access an attribute ("filename") on a null variable`
Matthew
CC BY-SA 3.0
2016-08-30T06:43:15.770Z
By all accounts, that code should be working. Have you tried using a different image?
Fyrebase
CC BY-SA 3.0
2016-08-30T06:47:27.423Z
Yep i have tried a couple of images now just to be sure, I have no idea why it wouldnt display the url
Matthew
CC BY-SA 3.0
2016-08-30T11:14:37.387Z
It's a tough one to figure out with out getting into your code first hand :(
Fyrebase
CC BY-SA 3.0
2016-08-30T20:05:10.573Z
@matthew Do you get an error or just no URL output?  i.e. `<img src="" ` And are you testing with devMode enabled?
Brad Bell
CC BY-SA 3.0
2016-08-30T22:50:08.327Z
No error but I have posted an answer to this issue and has been resolved thanks for your help @fyrebase and Brad
Matthew
<templating><assets><image>
Image asset url is not being output
# Image asset url is not being output

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

After going through the documentation I believe that this is the correct code to output the url for the asset field but its not working and I have no idea why. Please help!
{% nav program in craft.entries.section('program').level(1) %}
  {% set active = entry is defined and program.isAncestorOf(entry) %}

  
      {% if program.featureImage|length %}
        
      {% endif %}
      {{ program.title }}
      {{ program.description }}
  

{% endnav %}

**Tags:** templating, assets, image

> **Comments:**
> **username_1**: That looks correct. Are the other variables such as `program.url` and `program.title` working? What value do you get when outputting `program.featureImage|length`?  
> **username_0**: `program.url` and `program.title` are both working as intended they output the correct data. I get a value of `1` when outputting `program.featureImage|length` by itself. Its a really wierd cause everything indicates that it should just output the image url  
> **username_0**: I have just included the output of when i do a dump on `program.featureImage`  
> **username_1**: What does `{{ program.featureImage.first.filename }}` output?  
> **username_0**: When I try that i get the following error `Impossible to access an attribute ("filename") on a null variable`  
> **username_1**: By all accounts, that code should be working. Have you tried using a different image?  
> **username_0**: Yep i have tried a couple of images now just to be sure, I have no idea why it wouldnt display the url  
> **username_1**: It's a tough one to figure out with out getting into your code first hand :(  
> **username_2**: @matthew Do you get an error or just no URL output?  i.e. `<img src="" ` And are you testing with devMode enabled?  
> **username_0**: No error but I have posted an answer to this issue and has been resolved thanks for your help @fyrebase and Brad  

---

## 1 answers

### Answer by username_0 on 2016-08-30. Score: 17 | Accepted answer

So after looking through other craft websites to see how they where able to get images to work I discovered what I did wrong when setting up the asset source. The thing is though that the craft documentation is not very helpful in this regard, also there are no errors or helpful output to indicate that my configuration might be the issue.

[![What I needed to do](https://i.sstatic.net/yhllh.png)](https://i.sstatic.net/yhllh.png)


---

