With Kirby's Thumbnail API, thumbs are generated asynchronously. This makes thumb creation feel a lot faster and creates less memory issues, which could easily become an issue with many images or when creating many different images sizes to serve responsive images.
A new set of plugin extensions can be used to hook into the thumbnail API or the thumbnail URLs, see core components.
In a default setup, thumbnails are stored in the
With the thumb method, you can perform multiple image manipulations at once: resizing, cropping, changing the image format, converting to grayscale, and blurring. If you wanted to do everything at once, the code would look like this:
In the Reference: $file->thumb()
Most of the time, you don't want to use all options though. On top, the thumb method is quite verbose. Luckily, Kirby comes with a set of shortcuts methods:
blur(). Additionally, you can define default settings in your config file. But one step after the other.
Here are some examples for using the shortcut methods, more details with all options in the Reference:
In the Reference: $file->resize()
Kirby will automatically use a focus point set for the image when set, otherwise use the default thumb settings.
In the Reference: $file->crop()
blur method applies a blur filter to an image. You can modify the intensity of the blur effect by passing an integer. The default value is 10.
In the Reference: $file->blur()
The grayscale method converts an image to grayscale.
In the Reference: $file->grayscale()
Options for thumbnails are set with the
thumbs key in Kirby's configuration:
In the Reference: All thumbs options
You can define option presets for thumbs in your
Then you can use these presets e.g. in your templates:
Check out our cookbook recipe Responsive images to learn more.
You can use the
format option to convert an existing JPEG, GIF or PNG into a WebP or AVIF file with the
The format option can also be used in srcset definitions.
With Kirby's thumb engine, you can resize, crop and otherwise manipulate images. Here are the links to relevant resources: