From f361c6f15751473183e79ca1790539fc372297cd Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 13 Feb 2024 11:54:13 +0000 Subject: [PATCH] Docs: Revisit the canonical location for the `image_save_progressive` filter. This aims to bring consistency with the `image_make_intermediate_size` filter, which has the main DocBlock in `WP_Image_Editor_GD::_save()` and a duplicate hook reference in `WP_Image_Editor_Imagick::_save()`. Follow-up to [57607]. See #21668. Built from https://develop.svn.wordpress.org/trunk@57614 git-svn-id: http://core.svn.wordpress.org/trunk@57115 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-image-editor-gd.php | 9 ++++++++- wp-includes/class-wp-image-editor-imagick.php | 16 +++++++--------- wp-includes/version.php | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/wp-includes/class-wp-image-editor-gd.php b/wp-includes/class-wp-image-editor-gd.php index 938ae61d48..cbfa6dba38 100644 --- a/wp-includes/class-wp-image-editor-gd.php +++ b/wp-includes/class-wp-image-editor-gd.php @@ -505,7 +505,14 @@ class WP_Image_Editor_GD extends WP_Image_Editor { } if ( function_exists( 'imageinterlace' ) ) { - /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */ + /** + * Filters whether to output progressive images (if available). + * + * @since 6.5.0 + * + * @param bool $interlace Whether to use progressive images for output if available. Default false. + * @param string $mime_type The mime type being saved. + */ imageinterlace( $image, apply_filters( 'image_save_progressive', false, $mime_type ) ); } diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index 64babdad5a..7338fa8b34 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -821,16 +821,13 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { return new WP_Error( 'image_save_error', $e->getMessage(), $filename ); } - if ( method_exists( $this->image, 'setInterlaceScheme' ) && method_exists( $this->image, 'getInterlaceScheme' ) && defined( 'Imagick::INTERLACE_PLANE' ) ) { + if ( method_exists( $this->image, 'setInterlaceScheme' ) + && method_exists( $this->image, 'getInterlaceScheme' ) + && defined( 'Imagick::INTERLACE_PLANE' ) + ) { $orig_interlace = $this->image->getInterlaceScheme(); - /** - * Filters whether to output progressive images (if available). - * - * @since 6.5.0 - * - * @param bool $interlace Whether to use progressive images for output if available. Default false. - * @param string $mime_type The mime type being saved. - */ + + /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */ if ( apply_filters( 'image_save_progressive', false, $mime_type ) ) { $this->image->setInterlaceScheme( Imagick::INTERLACE_PLANE ); // True - line interlace output. } else { @@ -846,6 +843,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { try { // Reset original format. $this->image->setImageFormat( $orig_format ); + if ( isset( $orig_interlace ) ) { $this->image->setInterlaceScheme( $orig_interlace ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index fa86be33ad..612a438d16 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-alpha-57613'; +$wp_version = '6.5-alpha-57614'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.