File blueprint : Let user choose SVG but don't convert it into webp in that case

Hi there,

here’s a file blueprint :

title: Logo

accept: image/jpeg, image/png, image/webp
create:
  format: webp
image:
  cover: true

So far, it’s working greatly. But I’ve been asked to add support for SVG, though I’d like to keep the conversion to wepb.

I tried this :

title: Logo

accept: image/jpeg, image/png, image/webp, image/svg+xml
create:
  format: webp
image:
  cover: true

Then user can select SVG to upload but it results into an error and the image is somehow corrupted.

If I avoid the conversion to webp, it’s working fine. I’m guessing Kirby is trying to convert the SVG to Webp…

Is there a way to define that it shouldn’t convert to webp when an svg is uploaded, but to keep the conversion for other kinds of image type please ?

Thanks.

I’d suggest to not convert on upload but convert in your template instead when needed

I see. I guest by using this : $file->thumb() | Kirby CMS ?

Yes, exactly.

1 Like