Make WordPress Core

Opened 6 years ago

Last modified 5 years ago

#42487 new enhancement

Avoid redundant crops for all Customizer media controls.

Reported by: joemcgill's profile joemcgill Owned by:
Milestone: Future Release 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 (2)

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


5 years ago

#2 @kirasong
5 years ago

  • Milestone changed from Awaiting Review to Future Release

Hey Joe!

Saw this ticket while triaging media tickets without responses.
I think this is still a good idea, so commenting/setting it to Future Release to help make it clear it's been triaged.

Note: See TracTickets for help on using tickets.