I want to list products in section with thumbnail instead of original image.
Tried following but not working:
Section YML file:
image:
query: page.thumbnail
ratio: 1/1
back: pattern
Page model:
public function thumbnail(int $width = 300, int $height = 300)
{
if ($featuredImage = $this->featuredImage()->toFile()) {
return $featuredImage->crop(300, 300);
}
}
When i remove the crop/resize method working properly:
if ($featuredImage = $this->featuredImage()->toFile()) {
return $featuredImage;
}
I guess it’s because different objects output: Kirby\Cms\FileVersion
and Kirby\Cms\File
But I need to use crops for performance.