Media: Recognize .ico files as displayable images on PHP 5.3+ and allow attachment meta data to be generated for them.

Props remyvv, Guido07111975.
Fixes #43458.
Built from https://develop.svn.wordpress.org/trunk@42780


git-svn-id: http://core.svn.wordpress.org/trunk@42610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-03-05 01:03:31 +00:00
parent e451dfac9e
commit 5596017878
2 changed files with 6 additions and 1 deletions

View File

@ -556,6 +556,11 @@ function file_is_valid_image( $path ) {
function file_is_displayable_image( $path ) {
$displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP );
// IMAGETYPE_ICO is only defined in PHP 5.3+.
if ( defined( 'IMAGETYPE_ICO' ) ) {
$displayable_image_types[] = IMAGETYPE_ICO;
}
$info = @getimagesize( $path );
if ( empty( $info ) ) {
$result = false;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42779';
$wp_version = '5.0-alpha-42780';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.