#38965 closed defect (bug) (fixed)
Thumbnails with dimensions lower than the thumbnail setting aren't recognized
Reported by: | Clorith | Owned by: | joemcgill |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Media | Keywords: | has-patch has-unit-tests commit dev-reviewed |
Focuses: | Cc: |
Description
If an image is uploaded with a width and height lower than those defined in Settings > media
, the thumbnail size won't be defined, and the default "file" icon is shown in grid view (in list view it will show a version of the thumbnail).
This goes both for the media listing, as well as the add media modal.
This is a regression from 4.6, as thumbnails for smaller images are generated as expected on 4.6.1
As reported by @leemon in https://wordpress.org/support/topic/no-thumbnails-in-the-grid-view-of-the-media-library/
Attachments (2)
Change History (12)
#2
@
8 years ago
- Keywords has-patch needs-unit-tests added
- Milestone changed from Awaiting Review to 4.7
- Status changed from reviewing to accepted
#3
@
8 years ago
Just to make sure it makes its way back here from Slack, +1 for commit of this patch, but holding off on adding the tag because @joemcgill noted he'd like it to go in with a unit test change (which is a good idea here).
Current tests pass.
#4
@
8 years ago
- Keywords has-unit-tests added; needs-unit-tests removed
38965.2.diff adds a unit test.
Turns out the issue is related to a change to
wp_prepare_attachment_for_js()
introduced in [38949], which results in asizes
attribute not being generated if there are no intermediate sizes in the metadata. Specifically, it's the change to this line:Old:
if ( $meta && 'image' === $type ) {
New:
if ( $meta && ! empty( $meta['sizes'] ) ) {
38965.diff addresses the issue by always adding a sizes attribute when the attachment type is an image.