I cannot seem to get crop or focus to work in Kirby 4? I have an events section where the events are pulled into the home page also, all the content comes in correctly, but the image doesn’t crop to the focal point set in the image upload field.
Blueprint:
fields:
cover:
label: Event Image
type: files
template: cover
layout: cards
info: "{{ file.dimensions }}"
size: large
max: 1
Template cover:
title: Image
accept:
mime: image/jpeg, image/png
fields:
alt:
label: Alt Text
type: text
required: true
PHP:
<?php
$EventsPage = page('events');
$events = $EventsPage->children()->listed();
?>
<?php foreach ($events as $event): ?>
<?php if($image = $event->cover()->toFile()): ?>
<img src="<?= $image->crop(768, 470)->url() ?>" width="768" height="470" alt="<?= $image->alt()->esc() ?>">
<?php endif ?>
<?php endforeach ?>
The cover image is brought into the page but it doesn’t seem to crop, nor does the focus work if this is set on the image.
Any help would be greatly appreciated.