Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#27997 closed defect (bug) (wontfix)

supports_mime_type not accounting for possibly different jpg mimetypes

Reported by: joetan Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Post Thumbnails Keywords:
Focuses: Cc:


Ran into a situation where supports_mime_type() in the WP_Image_Editor_GD class was being called with the $mime_type parameter set as "image/jpg"

this causes it to fail, since the function is looking for "image/jpeg", even though the image is actually a jpg

The result of this function failing, is that post thumbnails don't get generated for images.

simple fix to this, add a test for "image/jpg' to the switch statement:


switch( $mime_type ) {
			case 'image/jpg':
			case 'image/jpeg':
				return ($image_types & IMG_JPG) != 0;


Change History (3)

#1 @nacin
6 years ago

While jpg is a valid extension for a jpeg, image/jpg isn't a valid mime type. It's image/jpeg regardless of extension.

#2 @joetan
6 years ago

I agree, but practically speaking, this was just something I encountered in one of my client's WordPress installs.

I'm not entirely sure why image/jpg was being used in that setup (I can try to dig further), but I think it would be nice to add it as a fallback to catch it.

I think in most cases, people don't notice this issue, since WP will use the original image if it can't find the a properly sized version-- and that usually works well enough.

#3 @wonderboymusic
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

If the wrong mime-type was caused by WordPress, give steps to reproduce. But seems like that setup...

Note: See TracTickets for help on using tickets.