Kirby

Thumbnail sizes for file cards in panel

Hello Kirby users,

how do I set the thumbnail size for card layouts in the panel? It seems to default to 400px width.

Here’s my thumbnail configuration, which works perfectly fine but does not affect the panel thumbs at all:

'thumbs' => [
    'presets' => [
        'default' => ['width' => 600],
        'placeholder' => ['width' => 200, 'quality' => 80, 'blur' => true]
    ]
]

This is the blueprint for the image field:

type: files
headline: Image
layout: cards
size: small
info: "{{ file.dimensions }}"

and i’m extending it like this:

introImage1:
  extends: fields/image
  label: Image 1
  max: 1
  width: 2/3
  size: large
  image:
    ratio: 3/2
    cover: true

introImage2:
  extends: fields/image
  label: Image 2
  max: 1
  width: 1/3
  image:
    ratio: 3/4
    cover: true

And this is what I see in the panel (mind the scaled up 400px wide Image 1 preview):

Thanks! (>’-’)>

The presets are irrelevant for the Panel.

The card size should determine the size of the images but doesn’t, because the size is currently hardcoded.

This will be fixed in 3.2. You can already test this with 3.2.0 RC2.

Wow that was fast! Thanks a lot!

I just installed 3.2.0-rc.2. It is ‘sort of’ fixed in the sense that the new size seems to be hardcoded to 1408x instead of 400x. Not sure if this is still in the works, though…

Hm, it should be using srcset to adapt the size depending on screen size. Haven’t tested myself, though.

Oh, it does in fact use srcset. But the image size is chosen irrespective of card size, which is perfectly fine with me.

Kirby 3.2.0 currently only takes layout columns into account. The maximum possible image size is stored in the sizes attribute. It makes sense to also consider card sizes.