silverstripe / silverstripe-assets

Silverstripe Assets component
BSD 3-Clause "New" or "Revised" License
9 stars 65 forks source link

NEW WebP support in CMS #476

Closed maxime-rainville closed 2 years ago

maxime-rainville commented 2 years ago

This PR adds support for WebP images. The CMS will essentially treat them like JPEG and PNG images.

Please note:

michalkleiner commented 2 years ago

Can we extend or adjust an existing test adding the webp support there, too?

maxime-rainville commented 2 years ago

If we're concerned about content authors accidentally adding WepP image to site targetting IE11 users, we could just put this in a separate module which would allow project to opt-in to webp support.

Looking at the statcounter, IE11 has a global market share right now of 0.45%. And it's dropping rapidly ... it was 0.81% a year ago.

I'm thinking, most sites that still want to cater to IE11 users will probably be well aware not to use WebP images any way. We can probably address this with some user docs.

So it's basically making life somewhat better for the vast majority of project with a tiny risk that someone will accidentally publish a WebP image to a site that still support IE11.

@silverstripe/core-team Yeah :+1: Nay :-1: on merging this PR?

sminnee commented 2 years ago

IMO add support by default, and provide a config flag so that developers can turn it off on sites that require IE11 support

maxime-rainville commented 2 years ago

I tested to make sure this works with Imagick, which it does. I also validated that you can block webp file upload by adding snippet to your YML config:

SilverStripe\Assets\File:
  allowed_extensions:
    webp: false

Found a related bug here: https://github.com/silverstripe/silverstripe-asset-admin/pull/1256