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
This commit is contained in:
Sergey Biryukov 2024-02-13 11:54:13 +00:00
parent c2558a5eaa
commit f361c6f157
3 changed files with 16 additions and 11 deletions

View File

@ -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 ) );
}

View File

@ -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 );
}

View File

@ -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.