Preview images in panel too big

If the images have a layout of cards, the previews generated are 1408 pixels in width. Thats’s way too big for the tiny size they are displayed in.

I tried to change the size with a custom pageMethod

'preview' => function()
{
    return $this->images->first()->resize(300);
},

and in my section:

image:
  query: page.preview
  cover: true

the previews are not shown :frowning:

without the resize it works:

'preview' => function()
{
    return $this->images->first();
},

So two questions:

  1. Why is the resize not working in the page method? resize returns just another image object, or does it not?

  2. Why are preview images so large and are there other methods to make them smaller?

Thanks!

Nope, resize returns a FileVersion object, not a File object.

As regard thumb sizes, see this issue: Panel loads huge images in cards layout · Issue #2488 · getkirby/kirby · GitHub