Make WordPress Core


Ignore:
Timestamp:
04/10/2017 02:27:23 PM (7 years ago)
Author:
swissspidy
Message:

Media: Improve handling of non-image files in wp_get_image_mime.

This prevents non-image fileypes from returning a mime type of "application/octet-stream" when exif_imagetype() returns false.

Props blobfolio.
Fixes #40017.

Merges [40397] to the 4.7 branch.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/functions.php

    r40134 r40403  
    23672367    try {
    23682368        if ( is_callable( 'exif_imagetype' ) ) {
    2369             $mime = image_type_to_mime_type( exif_imagetype( $file ) );
     2369            $imagetype = exif_imagetype( $file );
     2370            $mime = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false;
    23702371        } elseif ( function_exists( 'getimagesize' ) ) {
    23712372            $imagesize = getimagesize( $file );
Note: See TracChangeset for help on using the changeset viewer.