WordPress.org

Make WordPress Core

Ticket #40415: 40415.1.diff

File 40415.1.diff, 1.9 KB (added by audrasjb, 2 years ago)

Adds FILTER_HAMMING to default filter in the current fallback

  • src/wp-includes/class-wp-image-editor-imagick.php

    diff --git a/src/wp-includes/class-wp-image-editor-imagick.php b/src/wp-includes/class-wp-image-editor-imagick.php
    index abb2150..526e9d3 100644
    a b class WP_Image_Editor_Imagick extends WP_Image_Editor { 
    285285         *
    286286         * @param int    $dst_w       The destination width.
    287287         * @param int    $dst_h       The destination height.
    288          * @param string $filter_name Optional. The Imagick filter to use when resizing. Default 'FILTER_TRIANGLE'.
     288         * @param string $filter_name Optional. The Imagick filter to use when resizing. Default 'FILTER_HAMMING'.
    289289         * @param bool   $strip_meta  Optional. Strip all profiles, excluding color profiles, from the image. Default true.
    290290         * @return bool|WP_Error
    291291         */
    292         protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_TRIANGLE', $strip_meta = true ) {
     292        protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_HAMMING', $strip_meta = true ) {
    293293                $allowed_filters = array(
    294294                        'FILTER_POINT',
    295295                        'FILTER_BOX',
    class WP_Image_Editor_Imagick extends WP_Image_Editor { 
    309309                );
    310310
    311311                /**
     312                * Filters to choose another resizing filter
     313                *
     314                * @param string $filter_name Filter name. Default 'FILTER_HAMMING';
     315                */
     316                $filter_name = apply_filters( 'imagick_resize_filter', $filter_name );
     317               
     318                /**
    312319                 * Set the filter value if '$filter_name' name is in our whitelist and the related
    313320                 * Imagick constant is defined or fall back to our default filter.
    314321                 */
    315322                if ( in_array( $filter_name, $allowed_filters ) && defined( 'Imagick::' . $filter_name ) ) {
    316323                        $filter = constant( 'Imagick::' . $filter_name );
    317324                } else {
    318                         $filter = defined( 'Imagick::FILTER_TRIANGLE' ) ? Imagick::FILTER_TRIANGLE : false;
     325                        $filter = defined( 'Imagick::FILTER_HAMMING' ) ? Imagick::FILTER_HAMMING : false;
    319326                }
    320327
    321328                /**