-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add support multiple image formats in pictures #53
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
What is the use case for this? I understand what the code does, but when would I typically need this? |
The use case is that we'll be able to automatically generate e.g. <picture>
<source type="image/webp" srcset="assets/images/pic.webp">
<img src="assets/images/pic.jpg">
</picture> In other words: it's a major performance feature as we can let the browser decide if it understands more modern image formats and if so, select this instead of the bigger (in bytes) one. |
And it will then make SEO rating tools like PageSpeed and co. very, very happy. |
Description ----------- Depends on contao/image#53 Related: php-imagine/Imagine#718 As @Toflar pointed out in contao/image#53 (comment) this feature makes it possible to automatically generate WEBP images. I didn’t add `webp` to the default `contao.image.valid_extensions` configuration because not all plattforms support it. If someone wants to use this feature they need to add `webp` to the valid extensions in their *config.yml*. Commits ------- 1b6ec2a Add support for image format conversion 271a98a Show help message if WEBP is not enabled c67f82f Use 1.0.0-beta3 version of contao/image c094d19 Fix tests 4631a2b Fix PHPStan issues 7465bcc Add formats to predifined sizes configuration f71cd1e Fix image and picture tests f3866e3 Fix PHPStan issues b9fe888 Fix PHPStan issues efe0c65 Fix the coding style 61accc2 Don’t use JSON for the formats option a6cf0a9 Fix the coding style
Description ----------- Depends on contao/image#53 Related: php-imagine/Imagine#718 As @Toflar pointed out in contao/image#53 (comment) this feature makes it possible to automatically generate WEBP images. I didn’t add `webp` to the default `contao.image.valid_extensions` configuration because not all plattforms support it. If someone wants to use this feature they need to add `webp` to the valid extensions in their *config.yml*. Commits ------- 1b6ec2ac Add support for image format conversion 271a98af Show help message if WEBP is not enabled c67f82fe Use 1.0.0-beta3 version of contao/image c094d193 Fix tests 4631a2b0 Fix PHPStan issues 7465bcc3 Add formats to predifined sizes configuration f71cd1e3 Fix image and picture tests f3866e34 Fix PHPStan issues b9fe8884 Fix PHPStan issues efe0c653 Fix the coding style 61accc28 Don’t use JSON for the formats option a6cf0a9a Fix the coding style
This pull request adds the possibility to use mutiple image formats and convert them automatically.
Examples:
Related: php-imagine/Imagine#718