-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
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
$filenameparameter to the filter - Re-filters the same
$output_formatsvariable 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_formatwill receive meaningful parameters - Keeps per-file processing logic in the upload response where it belongs
References
- WordPress/wordpress-develop PR: #10868
- Review comment: Editor: PHP backports for Client Side Media wordpress-develop#10868 (comment)
- Response: Editor: PHP backports for Client Side Media wordpress-develop#10868 (comment)
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackProjects
Status