Use modern image formats in background images for Cover blocks and Group blocks#2121
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #2121 +/- ##
==========================================
+ Coverage 67.22% 67.69% +0.47%
==========================================
Files 93 93
Lines 7758 7845 +87
==========================================
+ Hits 5215 5311 +96
+ Misses 2543 2534 -9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
westonruter
left a comment
There was a problem hiding this comment.
Thanks for working on this!
westonruter
left a comment
There was a problem hiding this comment.
This is getting close! The main thing left, other than the two minor suggestions I left, is to add PHPUnit tests for this new webp_uploads_filter_block_background_images() function.
|
Thanks @westonruter for the detailed review. I'll add the test cases and update the PR. 🙇 |
westonruter
left a comment
There was a problem hiding this comment.
Some micro nits to reduce extra newlines where they don't seem needed.
Summary
Fixes #2111
Relevant technical choices
Adds functionality to process background images used in Cover and Group blocks, particularly for cases with special styling options like fixed or repetitive backgrounds. Our current approach was limited to only processing
<img>tags in content, but this missed background images applied through inline CSS styles.When users set specific styling options in Cover blocks (such as fixed backgrounds) or Group blocks with background images, these images are added via inline styles rather than standard
<img>tags. As a result, these images weren't being converted to modern formats.