Skip to content

Kirby 6.0.0

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(
    name: 'my/thumbs',
    extends: [
        'components' => [
            'thumb' => function (App $kirby, string $src, string $dst, array $options) {
                $rootToThumb = myThumbGenerator($src, $dst, $options);

                return $rootToThumb;
            }
        ]
    ]
);

Parameters

Name Type Default Description
$kirbyrequired Kirby\Cms\App no default value
$srcrequired string no default value Root of the original file
$dstrequired string no default value Template string for the root to the desired destination
$optionsrequired array no default value All thumb options that should be applied: width, height, crop, blur, grayscale

Return type

string