Hello,
I’ve recently watched all the YouTube tutorials on the Kirby channel. However, I hit one snag along the way with the crop() method, and it’s keeping my new project from functioning as well. I’m attempting to crop and display the first image of each child page, on the parent page.
This code works,
<?php foreach ($page->children()->listed() as $project): ?> <a href="<?= $project->url() ?>"> <figure> <?= $project->image() ?> </figure> </a> <?php endforeach ?>
while this code does not.
<?php foreach ($page->children()->listed() as $project): ?> <a href="<?= $project->url() ?>"> <figure> <?= $project->image()->crop(320, 180) ?> </figure> </a> <?php endforeach ?>
My debugger gives the following:
Call to a member function crop() on null
which I don’t understand the meaning of. I’m running my site locally on PHP version 7.3.24. Any help would be much appreciated!