Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

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

Started by Dion 7 years ago · 2 replies · 649 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 Andy Miller, 2 days ago
0 67 2 days ago
General · by Veehem, 3 days ago
0 111 3 days ago
General · by milkboy, 4 days ago
0 112 4 days ago
General · by ian russell, 2 weeks ago
2 204 1 week ago
General · by pamtbaau, 1 month ago
2 461 2 weeks ago