Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#26808 closed defect (bug) (fixed)

Featured image not displaying if filetype is bmp

Reported by: t.sjogren Owned by: SergeyBiryukov
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.8
Component: Media Keywords: has-patch commit
Focuses: Cc:


If adding a .bmp-image as featured image the image is not displayed in back end or in front end. If i inspect markup the width="1" and height="1".
Same issue in media library.
Pre WP 3.8 this is not an issue.

Attachments (1)

26808.diff (719 bytes) - added by ericlewis 7 years ago.

Download all attachments as: .zip

Change History (11)

#1 @markoheijnen
7 years ago

Are you sure no plugins was doing this. The thing is that WordPress would never create image sizes for BMP's what so far as I know is needed to display the featured image.

I do have to so that there is some weirdness around BMP's in general probably caused by not having image sizes.

#2 @t.sjogren
7 years ago

I have done some more tests.
All plugins deactivated -> add .bmp -> don't show in library and in front end (featured image).
If i create a post and click -Add media- the image shows i modual. And if i add the image inline it shows i content editor and in front end.

I would never work with .bmp images my self but i can't "prevent" my clients to do so. If WordPress allows .bmp to be added then the image should also be displayed.

Have done the tests in another install (WP 3.6) and it works fine there.

#3 @markoheijnen
7 years ago

Did it also created the image sizes then? I doubt that it did that. The problem is that GD doesn't support resizing BMP's. Imagick does but I tested that and it didn't result in creating image sizes.

Also WordPress allows you to upload a tiff image. Should it then be displayed. The answer is no in this case because it isn't a web image.

#4 @ericlewis
7 years ago

The problem here is that BMPs are not whitelisted in file_is_displayable_image()1, which chokes wp_generate_attachment_metadata()2, so no sizing info is saved on upload.

7 years ago

#5 @ericlewis
7 years ago

In attachment:26808.diff, add bitmap to the whitelisted displayable filetypes.

#6 @ericlewis
7 years ago

  • Keywords has-patch added

#7 follow-up: @DrewAPicture
7 years ago

Not sure I see the benefit in introducing a single-use variable instead of just tacking another value onto the existing array.

#8 in reply to: ↑ 7 @ericlewis
7 years ago

Replying to DrewAPicture:

Not sure I see the benefit in introducing a single-use variable instead of just tacking another value onto the existing array.

Seemed more self-documenting and legible to me.

#9 @SergeyBiryukov
7 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.0

Confirmed the issue and the fix. GD still doesn't generate intermediate sizes for BMP, but at least the image is displayed correctly.

#10 @SergeyBiryukov
7 years ago

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

In 28589:

Add BMP to the list of displayable image types.

props ericlewis.
fixes #26808.

Note: See TracTickets for help on using tickets.