WordPress.org

Make WordPress Core

#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:
PR Number:

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)

no-favicon.jpg (44.6 KB) - added by Guido07111975 21 months ago.
No placeholder in list view
43458.patch (746 bytes) - added by remyvv 21 months ago.
43458.2.patch (12.7 KB) - added by remyvv 21 months ago.
Updated unit-tests as well.

Download all attachments as: .zip

Change History (13)

@Guido07111975
21 months ago

No placeholder in list view

#1 @SergeyBiryukov
21 months ago

  • Keywords needs-patch good-first-bug added

The list view is trying to display the icon, but with 1x1 dimensions for some reason.

@remyvv
21 months ago

#2 @remyvv
21 months 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.

The attached patch fixes this.

Version 0, edited 21 months ago by remyvv (next)

@remyvv
21 months ago

Updated unit-tests as well.

#3 @SergeyBiryukov
21 months ago

  • Milestone changed from Awaiting Review to 5.0

#4 @SergeyBiryukov
21 months 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 @SergeyBiryukov
21 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 42780:

Media: Recognize .ico files as displayable images on PHP 5.3+ and allow attachment meta data to be generated for them.

Props remyvv, Guido07111975.
Fixes #43458.

#6 @johnbillion
14 months ago

  • Keywords good-first-bug removed
  • Milestone changed from 5.0 to 5.0.1
  • Resolution fixed deleted
  • Status changed from closed to reopened

#7 @pento
12 months ago

  • Milestone changed from 5.0.1 to 5.0.2

#8 @pento
12 months ago

  • Milestone changed from 5.0.2 to 5.0.3

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


11 months ago

#10 @desrosj
11 months ago

  • Keywords has-patch removed
  • Milestone changed from 5.0.3 to 5.1
  • Resolution set to fixed
  • Status changed from reopened to closed

5.1 will be released shortly after 5.0.3, and as this is not within the 5.0.3 focuses (block editor bugs, regressions, and major bugs), it can wait.

Note: See TracTickets for help on using tickets.