Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#30211 closed defect (bug) (fixed)

WP_Image_Editor_Imagick::supports_mime_type return incorrect result for image/tiff

Reported by: mmems's profile mmems Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.0
Component: Media Keywords:
Focuses: Cc:

Description

I've got the case with TIFF files:
wp_get_mime_types() by default give for image/tiff these extensions: tif|tiff
In WP_Image_Editor::get_extension() return only the first one: tif.
But in WP_Image_Editor_Imagick::supports_mime_type() the test fail because ImageMacick support TIFF format (note the FF).

Solutions are:

  • in WP_Image_Editor_Imagick::supports_mime_type() add if( $mime_type == 'image/tiff' ) $imagick_extension = 'TIFF';
  • in WP_Image_Editor_Imagick::supports_mime_type() add if( $imagick_extension == 'TIF' ) $imagick_extension = 'TIFF';
  • in wp_get_mime_types() change 'tif|tiff' to 'tiff|tif'

Change History (3)

#1 @DrewAPicture
10 years ago

  • Component changed from General to Media

#2 @wonderboymusic
10 years ago

  • Milestone changed from Awaiting Review to 4.2

#3 @wonderboymusic
10 years ago

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

In 31044:

ImageMagick expects TIFF files to have .tiff as an extension, so the key in wp_get_mime_types() should be 'tiff|tif' not 'tif|tiff' so the proper extension is returned in WP_Image_Editor->get_extension() subclass invocations.

Fixes #30211.

Note: See TracTickets for help on using tickets.