Hello
Im creating my first Portfolio Page with Kirby. In my project template I want to fetch the uploaded images filtered by a size option that can be defined for each image.
This is the default.yml file for each image:
title: Default File
fields:
size:
label: size
type: select
options:
- small
- medium
- big
width: 1/2
caption:
label: Caption
type: textarea
This is how far I’ve come with my project.php template (sadly doesn’t work like i want it to):
<?php snippet('header') ?>
<section class="image-container">
<?php foreach($page->files()->filterBy('size', 'medium') as $image): ?>
<figure class="quarter-image">
<?= $image->crop(2000, 1200) ?>
</figure>
<?php endforeach ?>
</section>
<?php snippet("CTA") ?>
<?php snippet('footer') ?>
</page>
As Im really new to working with kirby and php in general im guessing there’s an easy solution for this that i just cant get on my own.