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 · 771 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, 1 week ago
4 180 2 days ago
General · by lynbor, 5 days ago
2 119 3 days ago
General · by Old Man Umby, 1 week ago
1 100 1 week ago
General · by Sebastian, 1 week ago
1 124 1 week ago
General · by Andy Miller, 3 weeks ago
0 248 3 weeks ago