mirror of
https://github.com/WordPress/WordPress.git
synced 2024-06-30 16:55:02 +02: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. Built from https://develop.svn.wordpress.org/trunk@40397 git-svn-id: http://core.svn.wordpress.org/trunk@40304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
57b386ef1e
commit
efab6e06ca
|
@ -2367,7 +2367,8 @@ function wp_get_image_mime( $file ) {
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
if ( is_callable( 'exif_imagetype' ) ) {
|
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' ) ) {
|
} elseif ( function_exists( 'getimagesize' ) ) {
|
||||||
$imagesize = getimagesize( $file );
|
$imagesize = getimagesize( $file );
|
||||||
$mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false;
|
$mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-40396';
|
$wp_version = '4.8-alpha-40397';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user