<p>Through Pixel and Tonic's support email, I figured out what the issue was. It turns out one of my entries didn't have a thumbnail and that was why the image was null. Stupid user error! I thought I had checked to make sure everything was good but I guess not. Thanks for the help @BradBell.</p>

CC BY-SA 3.0
2015-04-29T23:40:24.837Z
2015-04-29T23:40:24.837Z
anguiac7
<p>I have entries that contain a single graphic asset. I'm trying to use the graphic as a background image in my template. However, I'm unable to output the URI for the asset. I'm using <code>entry.graphic.first().url</code> but I get an error that the property is null. I'm using the dbug plugin to look at the properties and can see that the asset is being returned, however the URI property is null.</p>

<p>I am looping through entries and am unable to return the URI for any of the graphics. Any ideas?</p>

<p>Thanks!</p>

<p>EDIT: Sorry for the lack of code, guys! Below is my whole content block for the page so far.</p>

<pre><code>&lt;div class="container archive"&gt;
  &lt;h1&gt;Video Archives&lt;/h1&gt;

  {% for entry in craft.entries.section('watch').order('seriesStart desc').type('series') %}
    {% set thumb = entry.graphic.first() %}
    &lt;div class="col-md-3 seriesthumb" style="background-image: url('{{thumb.url}}');"&gt;&lt;/div&gt;
  {% endfor %}

&lt;/div&gt;
</code></pre>

<p>Thanks for the help!</p>

CC BY-SA 3.0
2015-04-23T02:01:04.050Z
I've noticed that if I try and pull the graphic's URI outside of the loop, I'm able to return it. It's when it's in the loop that I can't get the URI.
anguiac7
CC BY-SA 3.0
2015-04-23T05:45:46.990Z
What loop? Are you overwriting entry with that?
carlcs
CC BY-SA 3.0
2015-04-23T06:02:43.813Z
Hi anguiac! Can you please edit your question to include a larger code sample? What you've provided so far isn't enough to determine what may be the problem.
Lindsey D
CC BY-SA 3.0
2015-04-23T16:52:07.707Z
After `{% set thumb = entry.graphic.first() %}`, if you `{{ thumb | dbug }}`, is it the image you're expecting?
Brad Bell
CC BY-SA 3.0
2015-04-23T23:09:24.740Z
@BradBell yes, I see the properties for the image, but the URI property is NULL. I've re-uploaded and cleared the asset cache but nothing helped.
anguiac7
CC BY-SA 3.0
2015-04-24T00:14:11.177Z
Are the images saved in the cloud (S3, Rackspace, Google Cloud, etc.)?
Brad Bell
CC BY-SA 3.0
2015-04-24T03:03:58.733Z
@BradBell nope, they're in a local folder. If I go into assets and click View Asset I get the correct image and the URL in my address bar is correct.
anguiac7
<assets><assetfilemodel>
Image asset URI returning null
# Image asset URI returning null

(Asked by: username_0 on 2015-04-23)

I have entries that contain a single graphic asset. I'm trying to use the graphic as a background image in my template. However, I'm unable to output the URI for the asset. I'm using entry.graphic.first().url but I get an error that the property is null. I'm using the dbug plugin to look at the properties and can see that the asset is being returned, however the URI property is null.
I am looping through entries and am unable to return the URI for any of the graphics. Any ideas?
Thanks!
EDIT: Sorry for the lack of code, guys! Below is my whole content block for the page so far.

  Video Archives

  {% for entry in craft.entries.section('watch').order('seriesStart desc').type('series') %}
    {% set thumb = entry.graphic.first() %}
    
  {% endfor %}



Thanks for the help!

**Tags:** assets, assetfilemodel
> **Comments:**
> **username_0**: I've noticed that if I try and pull the graphic's URI outside of the loop, I'm able to return it. It's when it's in the loop that I can't get the URI.  
> **username_1**: What loop? Are you overwriting entry with that?  
> **username_2**: Hi anguiac! Can you please edit your question to include a larger code sample? What you've provided so far isn't enough to determine what may be the problem.  
> **username_3**: After `{% set thumb = entry.graphic.first() %}`, if you `{{ thumb | dbug }}`, is it the image you're expecting?  
> **username_0**: @BradBell yes, I see the properties for the image, but the URI property is NULL. I've re-uploaded and cleared the asset cache but nothing helped.  
> **username_3**: Are the images saved in the cloud (S3, Rackspace, Google Cloud, etc.)?  
> **username_0**: @BradBell nope, they're in a local folder. If I go into assets and click View Asset I get the correct image and the URL in my address bar is correct.  

---

## 1 answers

### Answer by username_0 on 2015-04-29. Score: 1 | Accepted answer

Through Pixel and Tonic's support email, I figured out what the issue was. It turns out one of my entries didn't have a thumbnail and that was why the image was null. Stupid user error! I thought I had checked to make sure everything was good but I guess not. Thanks for the help @BradBell.


---

