Skip to content

Client-Side Media: Move image_editor_output_format filtering to the upload response #75784

@adamsilverstein

Description

@adamsilverstein

Parent Issue

Part of #74333

Related trac ticket: https://core.trac.wordpress.org/ticket/64677

Context

In WordPress/wordpress-develop#10868 (Editor: PHP backports for Client Side Media), the image_editor_output_format filter is currently applied in the REST API index (get_index) by iterating over a list of possible input MIME types with an empty $output_formats array and no $filename parameter. As @westonruter pointed out, this doesn't match how wp_get_image_editor_output_format() normally applies the filter — it passes the actual filename and a pre-populated default mapping.

Problem

The current approach:

  • Passes an empty array as the default value instead of the normal default mapping
  • Does not supply a $filename parameter to the filter
  • Re-filters the same $output_formats variable across iterations, accumulating results in a way that doesn't match the server-side behavior
  • Is applied generically rather than per-upload, so plugins can't make decisions based on the actual input file

Proposed Solution

Move the image_editor_output_format logic from the REST API index response into the initial image upload response. This is already the pattern used for EXIF rotation data in client-side media processing.

Benefits:

  • The actual input filename and MIME type will be available, so the filter operates just like it does on the server side
  • Plugins that hook into image_editor_output_format will receive meaningful parameters
  • Keeps per-file processing logic in the upload response where it belongs

References

Metadata

Metadata

Labels

[Feature] Client Side MediaMedia processing in the browser with WASM[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No fields configured for Bug.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions