Skip to content

Conversation

vipul0425
Copy link
Contributor

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.

Copy link

github-actions bot commented Aug 8, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: vipul0425 <[email protected]>
Co-authored-by: westonruter <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

codecov bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 86.36364% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.69%. Comparing base (42bb977) to head (ca2a61f).
⚠️ Report is 46 commits behind head on trunk.

Files with missing lines Patch % Lines
plugins/webp-uploads/hooks.php 90.00% 4 Missing ⚠️
plugins/webp-uploads/helper.php 50.00% 2 Missing ⚠️
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     
Flag Coverage Δ
multisite 67.69% <86.36%> (+0.47%) ⬆️
single 36.30% <9.09%> (-0.41%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@b1ink0 b1ink0 added [Type] Bug An existing feature is broken [Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) labels Aug 8, 2025
@westonruter westonruter added this to the webp-uploads n.e.x.t milestone Aug 8, 2025
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

@vipul0425 vipul0425 requested a review from westonruter August 11, 2025 05:23
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vipul0425
Copy link
Contributor Author

Thanks @westonruter for the detailed review. I'll add the test cases and update the PR. 🙇

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some micro nits to reduce extra newlines where they don't seem needed.

@vipul0425 vipul0425 requested a review from westonruter August 11, 2025 07:34
@vipul0425 vipul0425 requested a review from westonruter August 12, 2025 14:48
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@westonruter westonruter merged commit 123450c into WordPress:trunk Aug 14, 2025
17 checks passed
@westonruter westonruter changed the title Adds function to process BG image for cover and group block. Use modern image formats in background images for Cover blocks and Group blocks Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) [Type] Bug An existing feature is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modern image formats not used for fixed background image in Cover Block
3 participants