Kirby 3 Imgix plugin

Hey there!

We would like to use imgix for images, so I thought writing a custom thumb generator is probably the best form of integrating it, since it would just mean calling $image->thumb().

I’ve had a look at the official docs and copy pasted the code. For imgix the only thing that needs to happen is replacing the hostname of the image URL:

<?php

Kirby::plugin('diesdasdigital/imgix-thumb', [
    'components' => [
        'thumb' => function (App $kirby, string $src, string $dst, array $options) {
            return "http://diesdas-v3.imgix.net/".$src;
        }
    ]
]);

But calling the $image->thumb()->url() still returns the old url. What do I need to change?

For thumb urls you have to use the fileversion component: https://getkirby.com/docs/reference/plugins/components/file-version

Example plugin for Cloudinary: https://github.com/getkirby/getkirby.com/blob/master/site/plugins/cloudinary/index.php

Thanks a lot! Will give this a try :slight_smile:

Thanks that worked well. I’ve published a composer package so that others have an easier time than me. :slight_smile:

3 Likes

That’s awesome! I just added it to the directory.

1 Like