From 84422e6d7d1bc30325332259bedbbefed7ce730a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 27 May 2014 13:25:14 +0000 Subject: [PATCH] Add BMP to the list of displayable image types. props ericlewis. fixes #26808. Built from https://develop.svn.wordpress.org/trunk@28589 git-svn-id: http://core.svn.wordpress.org/trunk@28414 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/image.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 750d22ae64..7203baecd6 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -413,13 +413,16 @@ function file_is_valid_image($path) { * @return bool True if suitable, false if not suitable. */ function file_is_displayable_image($path) { - $info = @getimagesize($path); - if ( empty($info) ) + $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP ); + + $info = @getimagesize( $path ); + if ( empty( $info ) ) { $result = false; - elseif ( !in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) ) // only gif, jpeg and png images can reliably be displayed + } elseif ( ! in_array( $info[2], $displayable_image_types ) ) { $result = false; - else + } else { $result = true; + } /** * Filter whether the current image is displayable in the browser.