Make WordPress Core

Ticket #21668: 21668.2.diff

File 21668.2.diff, 2.4 KB (added by adamsilverstein, 10 months ago)
  • src/wp-includes/class-wp-image-editor-gd.php

    diff --git a/src/wp-includes/class-wp-image-editor-gd.php b/src/wp-includes/class-wp-image-editor-gd.php
    index 23331c7f19..938ae61d48 100644
    a b class WP_Image_Editor_GD extends WP_Image_Editor { 
    504504                        $filename = $this->generate_filename( null, null, $extension );
    505505                }
    506506
     507                if ( function_exists( 'imageinterlace' ) ) {
     508                        /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
     509                        imageinterlace( $image, apply_filters( 'image_save_progressive', false, $mime_type ) );
     510                }
     511
    507512                if ( 'image/gif' === $mime_type ) {
    508513                        if ( ! $this->make_image( $filename, 'imagegif', array( $image, $filename ) ) ) {
    509514                                return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) );
  • 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 546ad3e799..7aba202c17 100644
    a b class WP_Image_Editor_Imagick extends WP_Image_Editor { 
    489489                                        $this->image->setImageDepth( 8 );
    490490                                }
    491491                        }
    492 
    493                         if ( is_callable( array( $this->image, 'setInterlaceScheme' ) ) && defined( 'Imagick::INTERLACE_NO' ) ) {
    494                                 $this->image->setInterlaceScheme( Imagick::INTERLACE_NO );
    495                         }
    496492                } catch ( Exception $e ) {
    497493                        return new WP_Error( 'image_resize_error', $e->getMessage() );
    498494                }
    class WP_Image_Editor_Imagick extends WP_Image_Editor { 
    825821                        return new WP_Error( 'image_save_error', $e->getMessage(), $filename );
    826822                }
    827823
     824                if ( method_exists( $this->image, 'setInterlaceScheme' ) && defined( 'Imagick::INTERLACE_PLANE' ) ) {
     825                        /**
     826                         * Filters whether to use output interlaced (progressive) images.
     827                         *
     828                         * @since 6.5.0
     829                         *
     830                         * @param bool   $interlace Whether to use interlaced images. Default false.
     831                         * @param string $mime_type The mime type being saved.
     832                         */
     833                        if ( apply_filters( 'image_save_progressive', false, $mime_type ) ) {
     834                                $this->image->setInterlaceScheme( Imagick::INTERLACE_NONE );
     835                        } else {
     836                                $this->image->setInterlaceScheme( Imagick::INTERLACE_PLANE );
     837                        }
     838                }
     839
    828840                $write_image_result = $this->write_image( $this->image, $filename );
    829841                if ( is_wp_error( $write_image_result ) ) {
    830842                        return $write_image_result;