Hi. I have installed Felix Häberles Plugin to convert JPG into WEBP. It all works fine, but in the frontend it displays both pictures JPG and WEBP. Is there anything to do extra? Kirby 3.9 is installed. Thanks.
If that plugin just add extra files in your page folder (note, I don’t know the plugin) and you fetch all files from the folder, then you get all files.
Do you really need the plugin, given that you can convert images to webp on the fly using Kirby without a plugin.
Thanks for your reply @texnixe. Can you tell me how to convert images in Kirby, we are new to this. Or where can I read about it? I haven’t found any information yet.
That would be via our thumbs engine, which cannot only create thumbs but also convert to webp or avif: Image thumbnails | Kirby CMS
I have this in my config file:
return [
‘panel’ => [
‘install’ => true,
],
‘thumbs’ => [
‘format’ => ‘webp’
],
];
And I tried this in the template:
<?= $project->image()->thumb()?>But its only working this way:
<?= $project->image()->thumb(['width' => 200, 'format' => 'webp'])?>But I don’t want to have a fix image size.
thumb(['format' => 'webp'])
without any size information should totally do the job
So I have to give the format ([‘format’ => ‘webp’]) in the config file AND in the template?
Well, theoretically, it should be possible to set it in the config only, and then overwrite in the template if needed. But that doesn’t seem to work if there are no other parameters for the thumb. Haven’t had a chance to debug this yet or examine the source code.
As an alternative you could create thumb default preset with just the format in the config, then you can call thumb()
without any params.
'thumbs' => [
'presets' => [
'default' => ['format' => 'webp']
],
],