WordPress.org

Make WordPress Core

Opened 14 months ago

Closed 4 months 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)

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

Download all attachments as: .zip

Change History (13)

@Guido07111975
14 months ago

No placeholder in list view

#1 @SergeyBiryukov
14 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
14 months ago

#2 @remyvv
14 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. And such wp_get_attachment_image outputs width and height as 1

The attached patch fixes this.

Last edited 14 months ago by remyvv (previous) (diff)

@remyvv
14 months ago

Updated unit-tests as well.

#3 @SergeyBiryukov
14 months ago

  • Milestone changed from Awaiting Review to 5.0

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

  • Milestone changed from 5.0.1 to 5.0.2

#8 @pento
4 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.


4 months ago

#10 @desrosj
4 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.