mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-06 05:34:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@40397 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2367,7 +2367,8 @@ function wp_get_image_mime( $file ) {
|
||||
*/
|
||||
try {
|
||||
if ( is_callable( 'exif_imagetype' ) ) {
|
||||
$mime = image_type_to_mime_type( exif_imagetype( $file ) );
|
||||
$imagetype = exif_imagetype( $file );
|
||||
$mime = ( $imagetype ) ? image_type_to_mime_type( $imagetype ) : false;
|
||||
} elseif ( function_exists( 'getimagesize' ) ) {
|
||||
$imagesize = getimagesize( $file );
|
||||
$mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false;
|
||||
|
||||
Reference in New Issue
Block a user