1

I'm new to using Craft CMS and trying to successfully make an image display.

I have set up a field with the handle heroImage and this is the code I have within the template.

{% set image = entry.heroImage.one() %}

<div>
<img src="{{ image.getUrl }}">
</div>

However, the image is not displaying in the browser.

DarkBee
  • 16,592
  • 6
  • 46
  • 58
Sam
  • 13
  • 4

3 Answers3

0

I think you forgot to add parenthesis after getUrl as it was a function (method). You can use below code for that.

{% set image = entry.heroImage.one() %}
<div>
<img src="{{ image.getUrl() }}">
</div>
Dharman
  • 30,962
  • 25
  • 85
  • 135
ZealousWeb
  • 1,647
  • 1
  • 10
  • 11
0

Users encountering this may want to check folder permissions. I encountered this in a site migration situation.

-1

Try this

  <img src="https://dev-craft3-384fa3039dfb.hyperlane.co/uploads/scren1.png" referrerpolicy="no-referrer" alt="ALI TEST LIVE LINK" />
Muhammad Ali
  • 341
  • 2
  • 7