WordPress.org

Make WordPress Core

Opened 6 months ago

#42487 new enhancement

Avoid redundant crops for all Customizer media controls.

Reported by: joemcgill Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-patch needs-unit-tests
Focuses: ui, javascript Cc:

Description

In WordPress 4.9, we made use of context metadata to keep from producing redundant crops in the media library for custom headers (see #21819). We should extend this behavior to all other media controls in the Customizer (e.g., custom logos, site icon, etc.).

There are a few parts to the implementation to keep in mind:

  1. We should only create one cropped attachment per context for a given site/theme option. So for instance, if a custom logo has already been cropped from an attachment for the theme being customized, we should replace that attachment instead of creating a new one. However, we should create a new attachment if the crop was created for a different theme (this may not apply to site-level settings).
  1. The context of an attachment should be included in the JSON model returned by wp_prepare_attachment_for_js() and used to filter contextual crops out of the main media attachment library. However, it would be great if those were not filtered when you've opened the media library from the context which those attachments are created/selected.

Change History (0)

Note: See TracTickets for help on using tickets.