Make WordPress Core


Ignore:
Timestamp:
04/09/2017 10:43:04 PM (8 years ago)
Author:
joemcgill
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r40124 r40397  
    23682368    try {
    23692369        if ( is_callable( 'exif_imagetype' ) ) {
    2370             $mime = image_type_to_mime_type( exif_imagetype( $file ) );
     2370            $imagetype = exif_imagetype( $file );
     2371            $mime = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false;
    23712372        } elseif ( function_exists( 'getimagesize' ) ) {
    23722373            $imagesize = getimagesize( $file );
Note: See TracChangeset for help on using the changeset viewer.