From 86b88bd2b7d5653ce5e1f5e3880b5146d02ed0f1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 27 May 2014 13:24:39 +0000 Subject: [PATCH] Add BMP to the list of displayable image types. props ericlewis. fixes #26808. git-svn-id: https://develop.svn.wordpress.org/trunk@28589 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/image.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php index 750d22ae64..7203baecd6 100644 --- a/src/wp-admin/includes/image.php +++ b/src/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.