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
This commit is contained in:
Sergey Biryukov 2014-05-27 13:24:39 +00:00
parent a25a5de409
commit 86b88bd2b7
1 changed files with 7 additions and 4 deletions

View File

@ -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.