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 →

Grab image on page from admin image picker

Started by Muut Archive 10 years ago · 2 replies · 767 views
10 years ago

I am trying to grab the image from this admin form field and place it on the page through the template. I have tried many different examples and nothing works. Can anyone point me in the right direction?

YAML
       header.chooseimage:
            type: filepicker
            folder: 'theme@:/images'
            label: Select a file
            preview_images: true
            acccept:
             - .png
             - .jpg
10 years ago

If the field is already saving to the page header, you just need to use {{ header.chooseimage }} in your page Twig template to render it.

10 years ago

Thanks for your help, I eventually worked it out as I was pulling through content in the same way. I still struggle with the media, but I guess I just need to work out the syntax as I am new to Grav.

Thanks for your help.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 673 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5336 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago