Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW WebP support in CMS #476

Merged

Conversation

maxime-rainville
Copy link
Contributor

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

Please note:

  • I tested with GD ... didn't try Imagick
  • This doesn't address the issue that some browsers (aka IE11) don't support WebP images. The CMS doesn't provide any feedback to content authors about the image potentially not working in older browsers.

src/File.php Outdated Show resolved Hide resolved
src/File.php Outdated Show resolved Hide resolved
@michalkleiner
Copy link
Contributor

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

@maxime-rainville
Copy link
Contributor Author

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 👍 Nay 👎 on merging this PR?

@sminnee
Copy link
Member

sminnee commented Feb 19, 2022

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
Copy link
Contributor Author

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: silverstripe/silverstripe-asset-admin#1256

@michalkleiner michalkleiner merged commit df992a2 into silverstripe:1 Apr 13, 2022
@maxime-rainville maxime-rainville deleted the pulls/1/webp-support branch April 13, 2022 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants