Skip to content

Kirby 4.1.2

Thumbs

Add your own thumb generator

If you are not happy with our built-in thumb generators, you can create your own.

/site/plugins/thumbs/index.php
Kirby::plugin('my/thumbs', [
    'components' => [
        'thumb' => function (App $kirby, string $src, string $dst, array $options) {
            $rootToThumb = myThumbGenerator($src, $dst, $options);

            return $rootToThumb;
        }
    ]
]);

Parameters

Name Type Default Description
$kirby * Kirby\Cms\App
$src * string Root of the original file
$dst * string Template string for the root to the desired destination
$options * array All thumb options that should be applied: width, height, crop, blur, grayscale

Return type

string