Make WordPress Core

Opened 6 months ago

Closed 3 months ago

Last modified 5 weeks ago

#64919 closed enhancement (fixed)

Media: Re-introduce client-side media processing feature

Reported by: adamsilverstein Owned by: adamsilverstein
Priority: normal Milestone: 7.1
Component: Media Version:
Severity: normal Keywords: has-patch has-unit-tests commit has-dev-note
Cc: Focuses:

Description

Description:

The client-side media processing feature (wasm-vips) was removed in [62081] (see #64906) because the VIPS WASM worker added too much build size overhead for the value provided at the time.

Once WordPress 7.1 has forked, this ticket re-introduces the feature for the next release cycle.

Changes Restored

Reverts the removal, restoring all:

  • PHP functions for client-side media processing (wp-includes/media.php)
  • REST API endpoints for attachment processing (class-wp-rest-attachments-controller.php)
  • Cross-origin isolation infrastructure (COOP/COEP headers in class-wp-rest-server.php)
  • VIPS script module registration (script-modules.php)
  • Media templates (media-template.php)
  • Default filter hooks (default-filters.php)
  • Build configuration (Gruntfile.js, tools/gutenberg/copy.js)
  • Associated PHPUnit and QUnit tests

14 files changed, ~1,625 lines restored.

PR

PR #11324

Change History (11)

This ticket was mentioned in PR #11324 on WordPress/wordpress-develop by @adamsilverstein.


6 months ago
#1

  • Keywords has-patch has-unit-tests added

## Summary

  • Reverts the removal in [62081] now that WordPress 7.1 has forked
  • Restores all PHP functions, REST API endpoints, cross-origin isolation infrastructure, VIPS script module handling, build configuration, and associated tests
  • 14 files restored, ~1,625 lines

## Test plan

  • [ ] CI passes (coding standards, PHPUnit, JS tests)
  • [ ] Verify client-side media processing functions are restored in wp-includes/media.php
  • [ ] Verify REST API endpoints for attachments are restored
  • [ ] Verify cross-origin isolation test suite passes
  • [ ] Verify VIPS script module registration is restored

Props adamsilverstein, jorbin.
See #64906.

#2 @audrasjb
4 months ago

Removing trunk version as this is not going to be shipped with WP 7.0 but in the next releases.

#3 @desrosj
4 months ago

  • Version trunk

Since this is an enhancement, there's no first version of WordPress this can be reproduced in. Removing trunk version.

@adamsilverstein commented on PR #11324:


4 months ago
#4

Testing this PR manually (and without gutenberg active), I get an error when uploading an image. Investigating!

https://github.com/user-attachments/assets/836dad5b-abed-4456-b156-e116375a8748

@adamsilverstein commented on PR #11324:


4 months ago
#5

Testing this PR manually (and without gutenberg active), I get an error when uploading an image. Investigating!

https://github.com/user-attachments/assets/836dad5b-abed-4456-b156-e116375a8748

@adamsilverstein commented on PR #11324:


4 months ago
#6

This worked well in my testing. After this PR, the client side media worked just as it was working before the revert.

7.1 is now open for commits, see https://make.wordpress.org/core/2026/05/20/commence-operation-wp-7-1/

As soon as I commit this, I plan to work to backport code for a series of improvements that have already merged to Gutenberg. These backports were blocked because the code was missing from core.

Here is a complete list of PRs to backport:

## 1. Merged PRs — backports ready to merge (once restored)

These have landed on Gutenberg trunk and touch reverted Core code, so they are blocked only by
the restore. All merged after the 2026-03-20 removal.

PR Merged PHP touched Core backport PR Status / notes
#76731 — Add HEIC support using platform capabilities 2026-04-20 class-gutenberg-rest-attachments-controller.php, load.php (HEIC companion-file handling) wordpress-develop#11323 — OPEN, drafted Core PR also bundles #78128. Blocked by revert.
#78128 — Guard `gutenberg_delete_heic_companion_file()` 2026-05-12 load.php Folded into wordpress-develop#11323 Hardening fix on top of #76731; rides the same Core PR.
#74903 — Add dimension validation to sideload endpoint 2026-05-15 class-gutenberg-rest-attachments-controller.php wordpress-develop#11100 — OPEN, drafted Validates dimensions on the sideload route. Blocked by revert.
#75888 — Enable concurrent sideload uploads 2026-04-20 class-gutenberg-rest-attachments-controller.php None yet — owes one Carries the Needs PHP backport label. No backport-changelog entry; open a Core PR.
#77036 — Deduplicate client-side image sizes with matching dimensions 2026-04-21 class-gutenberg-rest-attachments-controller.php None yet — owes one No backport-changelog entry and no backport label. Open a Core PR.
#77565 — Declare `convert_format` as boolean arg on sideload route 2026-04-23 class-gutenberg-rest-attachments-controller.php None yet — owes one No backport-changelog entry and no backport label. Open a Core PR.

---

## 2. Open PRs — draft the backport, keep it in draft until the GB PR merges

These touch reverted Core code but the Gutenberg PR is still open. Draft the Core PR if useful,
but keep it in draft until the Gutenberg PR lands (and the feature is restored).

PR PHP touched Core backport Status / notes
#78410 — Add animated GIF to video conversion via mediabunny animated-gif-to-video.php (new render-swap filter), class-gutenberg-rest-attachments-controller.php (animated-video / animated-video-poster sideload), client-assets.php, load.php None yet Carries Needs PHP backport. REST sideload roles depend on the CSM controller → blocked by revert. The editor also does GIF→video block-switching (core/video GIF variation); deletes attached files on media delete.
#77584 — Lazy-load JPEG XL (JXL) WASM on demand class-gutenberg-rest-attachments-controller.php (finalize_item / sideload_item), load.php (adds JXL upload mimes; renames gutenberg_delete_heic_companion_filegutenberg_delete_preserved_original_companion_file) None yet Reclassified: previously listed as JS-only, but it now touches the CSM controller and load.php → blocked by revert.
#78404 — Send Document-Isolation-Policy header on the site preview frame load.php (cross-origin-isolation setup) None yet Depends on the COI scaffolding the revert removed → blocked. Related to #76662.
#76662 — Broaden DIP header scope to all admin pages load.php (cross-origin-isolation setup) None yet Same COI scaffolding as #78404 → blocked. The two overlap; reconcile before backporting.
#76227 — WIP: Disable client-side media processing for non-Chromium browsers lib/compat/wordpress-7.0/media.php (feature gate), load.php (Chromium version detection) None yet WIP. Reassess once finalized; the Chromium-detection logic may or may not be Core-bound.

---

## 3. Watch list — related, but not blocked by the revert

PR State Why it's separate
#78420 — Return filtered `wp_editor_set_quality` in upload response OPEN Core backport drafted: wordpress-develop#11856 (OPEN). The image_quality field is added to the base WP_REST_Attachments_Controller schema / prepare_item_for_response, which exists in Core regardless of the revert — so not blocked by the restore. As an open PR, keep #11856 in draft until #78420 merges. Still waiting on a Trac ticket (core tests use placeholder @ticket 64906; replace once posted).
#75793 — Move image output format filtering to upload response MERGED Merged 2026-04-23 with the old No Core Sync Required bypass label. It does touch the CSM controller + load.php, so it likely owes a real Core backport once the feature is restored — reassess and open one.

#7 @adamsilverstein
4 months ago

The errors I posted previously (https://core.trac.wordpress.org/ticket/64919#comment:4) were user introduced - I had blocked the upload route in dev tools while testing the resiliency/error tickets.

#8 @adamsilverstein
4 months ago

  • Keywords commit added

This is ready for commit; first I'm going to work on the backport PRs all of the merged Gutenberg features requiring backports since this was reverted. That way I can restore the feature and bring it up to date as quickly as possible. See https://github.com/WordPress/wordpress-develop/pull/11324#issuecomment-4521354626

Last edited 4 months ago by adamsilverstein (previous) (diff)

@adamsilverstein commented on PR #11324:


3 months ago
#9

@westonruter addressed your feedback and planning to commit this soon.

#10 @adamsilverstein
3 months ago

  • Owner set to adamsilverstein
  • Resolutionfixed
  • Status newclosed

In 62428:

Media: Re-introduce client-side media processing feature.

Reverts the removal in [62081] now that WordPress 7.1 has forked. Restores all PHP functions, REST API endpoints, cross-origin isolation infrastructure, VIPS script module handling, build configuration, and associated tests.

Follow-up to [62081].

Props adamsilverstein, jorbin, westonruter.
Fixes #64919.
See #64906.

Note: See TracTickets for help on using tickets.