Hi,
quite new to Kirby 4.
I want to select a single image from multiple uploaded images to be the cover image.
That’s what I did:
I have a gallery.yml file
sections:
cover:
type: fields
label: Bild für Frontseite
fields:
coverImage:
type: files
label: Cover
max: 1
template: cover
gallery:
label: Gallery
type: files
layout: cards
in my corresponding .php I try to get the cover image by
<?php if ($image = $article->files()->template('cover')->first()): ?>
<img
alt="<?= $image->alt() ?>"
src="<?= $image->resize(300)->url() ?>"
....
>
What’s going wrong?