Make WordPress Core

Ticket #22949: class-wp-image-editor.php.patch

File class-wp-image-editor.php.patch, 1012 bytes (added by mattonomics, 12 years ago)
  • wp-includes/class-wp-image-editor.php

     
    371371
    372372                foreach( $extensions as $_extension ) {
    373373                        if ( preg_match( "/{$extension}/i", $_extension ) ) {
    374                                 return $mime_types[$_extension];
     374                                // asumes that the first mime type in the array is the most common/proper
     375                                return !is_array($mime_types[$_extension]) ? $mime_types[$_extension] : $mime_types[$_extension][0];
    375376                        }
    376377                }
    377378
     
    389390         * @return string|boolean
    390391         */
    391392        protected static function get_extension( $mime_type = null ) {
    392                 $extensions = explode( '|', array_search( $mime_type, wp_get_mime_types() ) );
     393                foreach ( wp_get_mime_types() as $extension => $mimes )
     394                        if ( $match = array_search( $mime_type, (array) $mimes ) )
     395                                $extensions = explode( '|', $extension );
    393396
    394397                if ( empty( $extensions[0] ) )
    395398                        return false;