I have a website with a hero image on most pages, defined in the page template. This image needs to have a set aspect ratio (2 wide 1 high). The client will be uploading all sorts of image sizes / aspect ratios. How can I get Kirby to crop images to 2:1 aspect ratio?
Or if you don’t want to hardcode the size, but just crop to whatever the largest possible 2:1 aspect ratio is (might end up really big if the user uploads images directly taken from a reflex, I wouldn’t do this):
<?php if ($page->hero_image()->isNotEmpty()): ?>
<?php endif ?>
and to my surprise pages with no set hero-image still work. I thought if the hero-image was missing/empty it would break the PHP and I’d get the PHP error page. Any ideas why it still works?