Custom Image not showing since Kirby 4

Hey there,
I switched from 3 to 4 (wonderful) but Iā€™m facing a small issue where the custom images I used for the cards layout with the page section
are not working properly anymore :

<?php

class AboutPage extends Page
{
    public function previewImage(): Pages
    {
        if ($image = $this->images()->first()) {
            return $image;
        }
        if (file_exists(kirby()->root('assets') . "/images/about.jpg")) {
            return new Asset("assets/images/about.jpg");
        }
        return false;
    }
}

This code used to work before 4. I added : Pages at the end since it generated a bug with the focus somehow. But now no images are being shown as they used to. My blueprint looks like that :

title: Site
tabs:
  content:
    label: Content
    icon: text
    sections:
      pages:
        type: pages
        layout: cards
        status: listed
        image:
          query: page.previewImage
          cover: true
        size: medium

  seo: seo/site

Any help ?
Thanks a lot.

I think it should be

public function previewImage(): Asset|File|null|false

Mh, this returns the previous error.

As if I kept it blank :
public function previewImage():

I had the same experience.
I removed ā€˜cover: trueā€™ in blueprint and it worked. Donā€™t know why.

Did you use Flo Kosiolā€™s Focus plugin prior to updating?

Not at all ! :slight_smile:

Any update on this?
I used the workaround @redroses suggested here but it shouldnā€™t be my solutionā€¦

Thanks

I think the problem here is the Asset which does not seem to support focus crop and instead generates an error. Thatā€™s probably a regression.

Iā€™ve also same issue in my plugin. Iā€™ve created an issue: