Make WordPress Core

Changeset 28589


Ignore:
Timestamp:
05/27/2014 01:24:39 PM (12 years ago)
Author:
SergeyBiryukov
Message:

Add BMP to the list of displayable image types.

props ericlewis.
fixes #26808.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/image.php

    r28367 r28589  
    414414 */
    415415function file_is_displayable_image($path) {
    416         $info = @getimagesize($path);
    417         if ( empty($info) )
     416        $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP );
     417
     418        $info = @getimagesize( $path );
     419        if ( empty( $info ) ) {
    418420                $result = false;
    419         elseif ( !in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) )     // only gif, jpeg and png images can reliably be displayed
     421        } elseif ( ! in_array( $info[2], $displayable_image_types ) ) {
    420422                $result = false;
    421         else
     423        } else {
    422424                $result = true;
     425        }
    423426
    424427        /**
Note: See TracChangeset for help on using the changeset viewer.