Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

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

Started by Dion 7 years ago · 2 replies · 759 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 jeremycherfas, 4 days ago
3 92 58 minutes ago
General · by Old Man Umby, 2 days ago
1 60 2 days ago
General · by Sebastian, 4 days ago
1 81 4 days ago
General · by Andy Miller, 2 weeks ago
0 216 2 weeks ago
General · by ready-4-IT, 6 months ago
1 716 3 weeks ago