WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#36256 closed defect (bug) (fixed)

Custom Logo: Customizer display should match theme crop

Reported by: mor10 Owned by: obenland
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.6
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

When a Custom Logo is added, the preview in the Customizer sidebar does not reflect the crop factor of the actual Custom Logo.

Below, displayed image in theme is cropped to a square 96x96, but UI in sidebar shows a rectangle version.

https://cldup.com/1EDuG01doi.png

Attachments (2)

36256.diff (1.1 KB) - added by celloexpressions 3 years ago.
Use full image size in the Customizer for cropped image controls.
36256.2.diff (2.7 KB) - added by ocean90 3 years ago.

Download all attachments as: .zip

Change History (13)

#1 @westonruter
4 years ago

I'm not entirely sure about this. I think it makes sense that the preview is where the actual image size is used since that is where the preview is happening. The image appearing in the control would be more “meta” to indicate which image is chosen, not exactly how it appears. Otherwise, the same image would be displayed twice. Compare, for example, the site title and tagline: the text boxes show the raw database value whereas the preview shows the values as filtered by wptexturize and whatever the theme & plugins are doing.

If the actual image size for the logo were to be used in the control, it would require a couple changes:

1) The \WP_Customize_Media_Control::content_template is hard-coded to use the medium or full image sizes. So it would have to be updated to allow other image sizes to be used: https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/customize/class-wp-customize-media-control.php?marks=161-164#L154

2) The change in [36839] would need to be reverted/modified to allow the custom image sizes to be returned in Ajax requests. See #36096.

#2 @westonruter
4 years ago

Actually, it seems this would be resolved by the patch on #36255, since the action of cropping an image results in a new image with those cropped dimensions being the full size.

#3 @obenland
3 years ago

  • Milestone changed from Awaiting Review to 4.5

This ticket was mentioned in Slack in #core by mike. View the logs.


3 years ago

This ticket was mentioned in Slack in #core by mike. View the logs.


3 years ago

#6 @mikeschroder
3 years ago

  • Milestone changed from 4.5 to Future Release

This doesn't look to have been fixed by [37077] in #36255.

Chatted with @obenland, who notes that it's still a problem when the cropped size is larger than medium because, "It uses medium when available and falls back to full otherwise."

Given RC timeline, since this is a problem with WP_Customize_Media_Control::content_template rather than Custom Logo, and it would apply to any control that uses it, moving this to Future Release.

If a reasonable solution for Custom Logo is found (that would not affect backcompat for other controls), would consider inclusion.

@celloexpressions
3 years ago

Use full image size in the Customizer for cropped image controls.

#7 @celloexpressions
3 years ago

  • Keywords has-patch added
  • Milestone changed from Future Release to 4.5

If we check for the control type (separate from mime_type), we can fix this for all cropped image controls by always using the full size there (which is constrained in CSS to fit). When cropped, the full size is probably not excessively large, and this actually fixes what would be a bug for any other cropped image controls as well with no impact on back-compat.

See 36256.diff - I think this is a small enough change to go in now so moving back to 4.5 for consideration.

This ticket was mentioned in Slack in #core by obenland. View the logs.


3 years ago

#9 @mikeschroder
3 years ago

@mor10 Does 36256.diff resolve this issue for you?

@ocean90
3 years ago

#10 @obenland
3 years ago

  • Owner set to obenland
  • Status changed from new to accepted

#11 @obenland
3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in [37077]. By switching away from using a custom image size, we don't generate any downsized images anymore, only the file we need for the logo.

Note: See TracTickets for help on using tickets.