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.

git-svn-id: https://develop.svn.wordpress.org/trunk@57614 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2024-02-13 11:52:04 +00:00
parent bc713a0503
commit 670a260dae
2 changed files with 15 additions and 10 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 );
}