Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#22680 closed defect (bug) (fixed)

Check data.height and data.width before displaying dimensions

Reported by: nacin's profile nacin Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch commit
Focuses: Cc:

Description

A .ico file has either image/vnd.microsoft.icon or image/x-icon as its mime type. (Likely the latter due to wp_get_mime_types(), even though the former is canonical.)

This means it thinks it is an image. But, it doesn't have stored dimensions because in PHP we don't process icon files. That ends up with an awkward, lonely '×' where the dimensions sit, and it looks like a removal button if anything.

There might need to be other checks for icons, but I'm not really concerned about those edge cases. Even wp_attachment_is_image() simply let's ^/image/ pass, despite also checking the extension.

Attachments (1)

22680.diff (622 bytes) - added by nacin 11 years ago.

Download all attachments as: .zip

Change History (4)

@nacin
11 years ago

#1 @nacin
11 years ago

  • Keywords has-patch commit added

#2 @koopersmith
11 years ago

Looks sane. We might want to improve the check for image types to be more specific, but this is a good start.

#3 @nacin
11 years ago

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

In 22976:

Media templates: Make sure we have a width and height before printing dimensions. We don't calculate dimensions for icons. fixes #22680.

Note: See TracTickets for help on using tickets.