Skip to content

Remove client-side media processing feature#11309

Open
adamsilverstein wants to merge 7 commits intoWordPress:trunkfrom
adamsilverstein:remove-client-side-media
Open

Remove client-side media processing feature#11309
adamsilverstein wants to merge 7 commits intoWordPress:trunkfrom
adamsilverstein:remove-client-side-media

Conversation

@adamsilverstein
Copy link
Member

@adamsilverstein adamsilverstein commented Mar 19, 2026

Summary

  • Removes the wasm-vips client-side media processing feature from WordPress 7.0, punting it to 7.1
  • The VIPS WASM worker alone adds ~16MB to the build output (~36% of script-modules/), which is too much build size overhead for the current value provided
  • Removes all PHP functions, REST API endpoints (sideload/finalize), cross-origin isolation infrastructure, VIPS script module handling, build configuration, and associated tests (1,507 lines deleted across 12 files)

Trac ticket: https://core.trac.wordpress.org/ticket/64906

What's removed

  • 7 PHP functions in media.php (client-side media processing, cross-origin isolation, DIP headers)
  • REST API /sideload and /finalize endpoints and generate_sub_sizes/convert_format params
  • REST index image processing settings block
  • Cross-origin isolation output buffering in media-template.php
  • VIPS script module registration and minified filename handling
  • VIPS-related build exclusion rules in Gruntfile.js and tools/gutenberg/copy.js
  • Test file wpCrossOriginIsolation.php and 9 sideload/finalize/generate_sub_sizes tests

What's preserved (independent features)

  • wp_prevent_unsupported_mime_type_uploads filter (#64836)
  • X-WP-Upload-Attachment-ID header (error recovery)
  • Pre-existing post-process and edit endpoints
  • exif_orientation, filename, filesize, missing_image_sizes schema properties

Test plan

  • Run phpunit tests/phpunit/tests/media/ — verify no failures
  • Run phpunit tests/phpunit/tests/rest-api/rest-attachments-controller.php — verify no failures
  • Run phpunit tests/phpunit/tests/rest-api/rest-schema-setup.php — verify route list is correct
  • Verify standard image upload via REST API still works with server-side sub-size generation
  • Run npx grunt build --dev — verify build succeeds
  • Confirm build/wp-includes/js/dist/script-modules/vips/ no longer exists after build

AI use

I created this PR with careful prompting and planning in Claude Code. I will review the code and test the result.

Punt the wasm-vips client-side media processing feature to
7.1 as it adds ~16MB of WASM to the build without sufficient
value for 7.0. Removes all PHP functions, REST API endpoints
(sideload/finalize), cross-origin isolation, VIPS script
module handling, and associated tests.
@github-actions
Copy link

github-actions bot commented Mar 19, 2026

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props adamsilverstein, jorbin.

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

Remove extra blank lines before closing braces in
register_routes() and wp_print_media_templates().
@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Missed in the initial removal of the client-side media
processing feature.
Remove image_sizes, image_size_threshold,
image_output_formats, interlaced settings from REST
index, and generate_sub_sizes/convert_format params
from media create endpoint.
@aaronjorbin
Copy link
Member

I tried to check all of the commits. For the most part, this looks good however I noticed that test_vips_script_modules_always_use_minified_paths wasn't removed. Should that also be removed?

…les.

The previous build config only excluded non-minified vips files, but with client-side media processing removed from Core, vips should not be copied or registered at all. This adds:

- `!vips/**` exclusion to the Gruntfile copy task
- Skip `vips` directory in `generateScriptModulesPackages()` so vips modules are not auto-registered
- Update test to assert vips modules are not registered in Core

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@adamsilverstein
Copy link
Member Author

I tried to check all of the commits. For the most part, this looks good however I noticed that test_vips_script_modules_always_use_minified_paths wasn't removed. Should that also be removed?

it should be removed now, I left a "test_vips_script_modules_not_registered_in_core"

WP_Script_Modules::$registered is private with no public getter.
Use the same enqueue-and-check-output pattern as the original test
to verify vips modules are not registered.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@adamsilverstein
Copy link
Member Author

adamsilverstein commented Mar 19, 2026

Build Size Comparison: vips exclusion

Release zip impact

Zip Size Difference from 6.9.1
WordPress 6.9.1 (latest stable) 27 MB
Nightly (with vips) 61 MB +34 MB (+126%)
Nightly without vips 57 MB +30 MB (+111%)
vips savings in zip 4 MB

The nightly zip is currently 61 MB vs 27 MB for 6.9.1. Removing vips saves 4 MB in the compressed zip (61 MB -> 57 MB). The remaining ~30 MB increase over 6.9.1 comes from other new packages and features in 7.0.

Note: vips is 13 MB uncompressed but compresses to ~4 MB in the zip since the inlined wasm binary is base64-encoded data that still compresses reasonably well.

Full build directory (uncompressed)

Directory Trunk (before) PR branch (after) Savings
src/ (total) 156 MB 143 MB 13 MB (8%)
wp-includes/ 87 MB 74 MB 13 MB (15%)
js/dist/ 41 MB 28 MB 13 MB (32%)

script-modules/ breakdown

Metric Trunk (before) PR branch (after) Savings
script-modules/ total 15 MB 2.2 MB 12.8 MB (85%)
script-modules/vips/ 13 MB gone 13 MB

The upload-media package in the Gutenberg build artifact declares
@wordpress/vips/worker as a dynamic module dependency. Since vips
is excluded from Core, this unregistered dependency causes a
_doing_it_wrong notice on every admin page load.

Filter out @wordpress/vips/* module dependencies during the
script-loader-packages.php generation step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants