diff --git a/docs/en/02_Developer_Guides/14_Files/06_Allowed_file_types.md b/docs/en/02_Developer_Guides/14_Files/06_Allowed_file_types.md index 1fcc6c52d..66c9f8c96 100644 --- a/docs/en/02_Developer_Guides/14_Files/06_Allowed_file_types.md +++ b/docs/en/02_Developer_Guides/14_Files/06_Allowed_file_types.md @@ -90,3 +90,43 @@ SilverStripe\MimeValidator\MimeUploadValidator: - 'text/plain' - 'text/calendar' ``` + +## Adding new image types {#add-image-format} + +Silverstripe CMS support JPEG, GIF, PNG and WebP image formats out of the box. Silverstripe CMS can be configured to support other less common image formats (e.g.: AVIF). For this to work, your version of PHP and of the [`intervention/image` library](https://intervention.io/) must support these alternative image formats. + +For example, this snippet can be added to the configuration of older Silverstripe CMS projects to allow them to work with WebP images. + +```yml +--- +Name: myproject-assetsfiletypes +After: '#assetsfiletypes' +--- +SilverStripe\Assets\File: + file_types: + webp: 'WebP Image' + allowed_extensions: + - webp + app_categories: + image: + - webp + image/supported: + - webp + class_for_file_extension: + webp: SilverStripe\Assets\Image + +SilverStripe\Assets\Storage\DBFile: + supported_images: + - image/webp + +--- +Name: myproject-mimevalidator +After: '#mimevalidator' +Only: + moduleexists: silverstripe/mimevalidator +--- +SilverStripe\MimeValidator\MimeUploadValidator: + MimeTypes: + webp: + - image/webp +``` diff --git a/docs/en/04_Changelogs/4.11.0.md b/docs/en/04_Changelogs/4.11.0.md index 1423cbcfe..e59a369e6 100644 --- a/docs/en/04_Changelogs/4.11.0.md +++ b/docs/en/04_Changelogs/4.11.0.md @@ -5,6 +5,7 @@ - [Regression test and Security audit](#audit) - [Dropping support for PHP 7.3](#phpeol) - [Features and enhancements](#features-and-enhancements) + - [Upload and use WebP images in the CMS](#webp) - [Preview any DataObject in any admin section](#cms-preview) - [Other features](#other-features) - [Bugfixes](#bugfixes) @@ -23,6 +24,33 @@ In accordance with our [PHP support policy](/Getting_Started/Server_Requirements ## Features and enhancements {#features-and-enhancements} +### Upload and use WebP images {#webp} + +WebP is an alternative image format for displaying picture on websites. It provides generally better results in most use cases to JPEG and PNG. + +Read [An image format for the Web](https://developers.google.com/speed/webp) for more information about WebP. + +WebP has wide – but not universal – support across web browsers. Internet Explorer is the main browser that does not support WebP at this stage. + +Read [Can I use WebP?](https://caniuse.com/webp) to see which browsers can render WebP images. + +Until now, Silverstripe CMS would default to blocking content authors from uploading WebP images. Given that [Internet Explorer will be end-of-life in June 2022](https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/) and that its market share are now under 1% according to most surveys, we decided the time had come to enable WebP by default in the CMS. + +Once your project is upgraded to Silverstripe Recipe CMS 4.11, your content authors will automatically be able to upload WebP images and add them to web pages. We recommend you have a conversation with your users about the pros and cons of WebP so they can make an informed decisions about when to use this image format. + +If your website still caters to a significant number of visitors with browsers that do not support WebP, you can disable WebP image upload by adding this snippet to your YML config: +```yml +--- +Name: myproject-assetsfiletypes +After: '#assetsfiletypes' +--- +SilverStripe\Assets\File: + allowed_extensions: + webp: false +``` + +Read [Allowed file types](/Developer_Guides/Files/Allowed_file_types) in the Silverstripe CMS documentation for more information on how to enable or disable new image file formats. + ### Preview any DataObject in any admin section {#cms-preview} The CMS preview panel has historically been available for `Versioned` `DataObject`s in the Pages admin section. This has now been expanded to allow any `DataObject` (regardless of whether it uses the`Versioned` extension) to be previewed in any section of the CMS.