WordPress.org

Make WordPress Core

Changeset 42780


Ignore:
Timestamp:
03/05/2018 01:02:20 AM (18 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk
Files:
1 added
2 edited

Legend:

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

    r42449 r42780  
    557557    $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP );
    558558
     559    // IMAGETYPE_ICO is only defined in PHP 5.3+.
     560    if ( defined( 'IMAGETYPE_ICO' ) ) {
     561        $displayable_image_types[] = IMAGETYPE_ICO;
     562    }
     563
    559564    $info = @getimagesize( $path );
    560565    if ( empty( $info ) ) {
  • trunk/tests/phpunit/tests/image/functions.php

    r42343 r42780  
    6262        );
    6363
     64        // IMAGETYPE_ICO is only defined in PHP 5.3+.
     65        if ( defined( 'IMAGETYPE_ICO' ) ) {
     66            $files[] = 'test-image.ico';
     67        }
     68
    6469        foreach ( $files as $file ) {
    6570            $this->assertTrue( file_is_valid_image( DIR_TESTDATA . '/images/' . $file ), "file_is_valid_image($file) should return true" );
     
    8792            'test-image.jpg',
    8893        );
     94
     95        // IMAGETYPE_ICO is only defined in PHP 5.3+.
     96        if ( defined( 'IMAGETYPE_ICO' ) ) {
     97            $files[] = 'test-image.ico';
     98        }
    8999
    90100        foreach ( $files as $file ) {
Note: See TracChangeset for help on using the changeset viewer.