<p>By the way, is your Craft CMS version 3.x? If so, using &quot;one&quot; is recommended instead of &quot;first&quot;, which is deprecated.</p>

CC BY-SA 4.0
2020-09-22T09:25:42.700Z
Yes, I tried that too. Nothing seems to work to get the file path
Fritko
CC BY-SA 4.0
2020-09-11T13:37:03.200Z
2020-09-11T13:37:03.200Z
Kota.M
<p>Is the &quot;Assets in this volume have public URLs&quot; turned on?</p>

CC BY-SA 4.0
2020-09-11T12:11:30.587Z
It wasn't before. But I found it a little later and turned it on. Still frontend won't show the image nor an error. Noticed thumbnails in CP show, but if I click to preview it, the image is 404.
Fritko
CC BY-SA 4.0
2020-09-16T13:06:11.547Z
Maybe you defined wrong path in volume - what is there? What is the path that errors out 404?
Ottó Radics
CC BY-SA 4.0
2020-09-22T09:25:14.743Z
I guess not, because getting the filename works. There must be something wrong with the output
Fritko
CC BY-SA 4.0
2020-09-23T10:55:17.110Z
What have you set as base URL for the volume?
Ottó Radics
CC BY-SA 4.0
2020-09-11T10:53:03.863Z
2020-09-11T10:53:03.863Z
Ottó Radics
<p>I am on my first Craft CMS test site. Have some problems showing a simple image.</p>
<pre><code>&lt;img src=&quot;{{ entry.hero.first().url }}&quot; title=&quot;{{ hero.title }}&quot;&gt;
</code></pre>
<p>I get the title but can't get the URL. The src attr is always empty. Tried a couple of variants like:</p>
<ul>
<li><code>entry.hero.first().url()</code></li>
<li><code>entry.hero.first().getUrl()</code></li>
<li>with and without ()</li>
<li>etc.</li>
</ul>
<p>But <code>entry.hero.first().filename</code> gives me &quot;my_testfile01.jpg&quot;</p>
<p>I can't see what is wrong.</p>
<p>File is local with path set to &quot;./&quot;
Image field has no sub path.</p>
<p>MAMP (Apache + PHP 7)</p>

<templating><image>
{{ entry.image.first().url }} won't show image
# {{ entry.image.first().url }} won't show image

(Asked by: username_0 on 2020-09-11)

I am on my first Craft CMS test site. Have some problems showing a simple image.


I get the title but can't get the URL. The src attr is always empty. Tried a couple of variants like:

entry.hero.first().url()
entry.hero.first().getUrl()
with and without ()
etc.

But entry.hero.first().filename gives me "my_testfile01.jpg"
I can't see what is wrong.
File is local with path set to "./"
Image field has no sub path.
MAMP (Apache + PHP 7)

**Tags:** templating, image


---

## 2 answers

### Answer by username_1 on 2020-09-11. Score: 2

By the way, is your Craft CMS version 3.x? If so, using "one" is recommended instead of "first", which is deprecated.

> **Comments:**
> **username_0**: Yes, I tried that too. Nothing seems to work to get the file path  

---

### Answer by username_2 on 2020-09-11. Score: 1

Is the "Assets in this volume have public URLs" turned on?

> **Comments:**
> **username_0**: It wasn't before. But I found it a little later and turned it on. Still frontend won't show the image nor an error. Noticed thumbnails in CP show, but if I click to preview it, the image is 404.  
> **username_2**: Maybe you defined wrong path in volume - what is there? What is the path that errors out 404?  
> **username_0**: I guess not, because getting the filename works. There must be something wrong with the output  
> **username_2**: What have you set as base URL for the volume?  

---

