Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#43458 closed defect (bug) (fixed)

No placeholder for ico file in list view of Media Library

Reported by: Guido07111975 Owned by: SergeyBiryukov
Priority: normal Milestone: 5.1
Component: Media Version: 4.9.4
Severity: normal Keywords:
Cc: Focuses:

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 9 years ago.
No placeholder in list view
43458.patch​ (746 bytes ) - added by remyvv 9 years ago.
43458.2.patch​ (12.7 KB ) - added by remyvv 9 years ago.
Updated unit-tests as well.

Download all attachments as: .zip

Change History (13)

@Guido07111975
9 years ago

No placeholder in list view

#1 @SergeyBiryukov
9 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.

@remyvv
9 years ago

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

Last edited 9 years ago by remyvv (previous) (diff)

@remyvv
9 years ago

Updated unit-tests as well.

#3 @SergeyBiryukov
9 years ago

  • Milestone Awaiting Review → 5.0

#4 @SergeyBiryukov
9 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 @SergeyBiryukov
9 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → 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
8 years ago

  • Keywords good-first-bug removed
  • Milestone 5.0 → 5.0.1
  • Resolution fixed
  • Status closed → reopened

#7 @pento
8 years ago

  • Milestone 5.0.1 → 5.0.2

#8 @pento
8 years ago

  • Milestone 5.0.2 → 5.0.3

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


8 years ago

#10 @desrosj
8 years ago

  • Keywords has-patch removed
  • Milestone 5.0.3 → 5.1
  • Resolution → fixed
  • Status reopened → 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.