Good day everyone,
I have this snippet to fetch the cover image:
<?php if ($cover = $card->images()->findBy("template", "cover")->crop(600, 600)): ?> <img class="media-cover" src="<?= $cover->url() ?>" alt="<?= $cover->alt()->html() ?>"> <?php endif ?>
When image is there everything is working fine. But sometimes I want to add posts without cover but it breaks the page and I’m getting standard error message. What is the best practice to avoid this?