Hi, when using this plugin i cannot upload svg files anymore from the panel, as they trigger the file.create:after hook but can't be converted to webp. (actually they get uploaded but trigger an error message).
I think .svg extension should be detected and ignored. To do so I replaced plugin's index.php with:
<?php
@include_once __DIR__ . '/vendor/autoload.php';
@include_once __DIR__ . '/src/webp.php';
Kirby::plugin('felixhaeberle/kirby3-webp', [
'hooks' => [
'file.create:after' => function ($file) {
if ($this->option('kirby3-webp', false) && $file->extension() !== 'svg') {
(new WebP\Convert)->generateWebP($file);
}
},
'file.replace:after' => function ($newFile, $oldFile) {
if ($this->option('kirby3-webp', false) && $file->extension() !== 'svg') {
(new WebP\Convert)->generateWebP($newFile);
}
},
],
]);
Hi, when using this plugin i cannot upload svg files anymore from the panel, as they trigger the
file.create:after
hook but can't be converted to webp. (actually they get uploaded but trigger an error message).I think
.svg
extension should be detected and ignored. To do so I replaced plugin'sindex.php
with:Thanks for the plugin and cheers !