I have an image in a matrix-field, but can't get the url from it.
dump(block.image.one().url)
says NULL
. My code is:
{% if entry.hero %}
{% for block in entry.hero %}
{% if block.type == 'hero' %}
{% set heroImage = block.image.one() %}
<div class="cell hero center padding-1" style="background-image: url({{ heroImage.url }});">
</div>
{% endif %}
{% endfor %}
{% endif %}
image.one()
or image.first()
, as well as .url
or .getUrl()
doesn't work the same.
What works though is {{ block.image.one().folderPath }}{{ block.image.one().filename }}
Does anyone know why? I'm on Craft CMS 3.3.15