Opened 7 years ago
Closed 6 years ago
#43458 closed defect (bug) (fixed)
No placeholder for ico file in list view of Media Library
Reported by: | Guido07111975 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | normal | Version: | 4.9.4 |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
Hi,
There's no placeholder image for an ico file in list view of the Media Library. But there is in grid view. Check attachment.
Guido
Attachments (3)
Change History (13)
#1
@
7 years ago
- Keywords needs-patch good-first-bug added
The list view is trying to display the icon, but with 1x1 dimensions for some reason.
#2
@
7 years ago
- Keywords has-patch added; needs-patch removed
I have looked into this issue and figured out this is occurs due too a omission of IMAGETYPE_ICO
in the $displayable_image_types
inside the function file_is_displayable_image
.
Because wp_generate_attachment_metadata
calls this function to check if it should generate the metadata for an upload, the metadata is not generated for .ico
files. And such wp_get_attachment_image
outputs width and height as 1
The attached patch fixes this.
#4
@
7 years ago
Thanks for the patch, @remyvv! It works as expected.
The only thing I noted is that IMAGETYPE_ICO
is only available in PHP 5.3+, while WordPress still supports 5.2.4+, so we'll have to check if it's defined.
It's also worth mentioning that metadata will only be generated for new icons, the ones previously uploaded will be left as is.
#5
@
7 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 42780:
#6
@
6 years ago
- Keywords good-first-bug removed
- Milestone changed from 5.0 to 5.0.1
- Resolution fixed deleted
- Status changed from closed to reopened
No placeholder in list view