wppaste
WordPress

apply_filters( 'jpeg_quality', int $quality, string $context )

Since
2.5.0
Filters the JPEG compression quality for backward-compatibility.

Description

Applies only during initial editor instantiation, or when set_quality() is run manually without the $quality argument. The WP_Image_Editor::set_quality() method has priority over the filter. The filter is evaluated under two contexts: 'image_resize', and 'edit_image', (when a JPEG image is saved to file).

Parameters

$qualityint
Quality level between 0 (low) and 100 (high) of the JPEG.
$contextstring
Context of the filter.

Fired at · 2

  • wp-admin/includes/image-edit.php:493wp_save_image_file()
  • wp-includes/class-wp-image-editor.php:288WP_Image_Editor::set_quality()

Source

				 *				 * @since 2.5.0				 *				 * @param int    $quality Quality level between 0 (low) and 100 (high) of the JPEG.				 * @param string $context Context of the filter.				 */				$quality = apply_filters( 'jpeg_quality', $quality, 'image_resize' );			} 			if ( $quality < 0 || $quality > 100 ) {				$quality = $default_quality;			}		}

History

Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.