Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Newbie Q: How to get the image url from custom image field

Started by Dion 7 years ago · 2 replies · 989 views
7 years ago

Hi, I have a custom image field and i want to get the url in twig.

test.yaml

header.slider:
type: file
label: Slider
type: file
destination: '@self'
description: Only .png, .jpg, .jpeg file types are allowed.
multiple: true
style: vertical
accept:

  • .png
  • .jpg
  • .jpeg
    ordering@: 2

test.html.twig

{% extends 'partials/base.html.twig' %}

{% block content %}
{% for slide in page.header.slider.images %}
<img src="{{ slide.url }}">
{% endfor %}
{% endblock %}

7 years ago

@dimitrilongo, This is actually what i'm looking for. Thank you very much.

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 23 hours ago
2 39 16 hours ago
General · by Hanns Mattes, 1 week ago
0 119 1 week ago
General · by Karmalakas, 1 week ago
2 184 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 234 3 weeks ago
General · by Dima, 4 weeks ago
1 210 4 weeks ago