jpeg_quality

This filter is documented in wp-includes/class-wp-image-editor.php.

Description

apply_filters( 'jpeg_quality', (int) $int, (string) $edit_image ); 

Parameters (2)

0. $int (int) => 90
The int.
1. $edit_image (string) => 'edit_image'
The edit image.

Usage

To run the hook, copy the example below.
  1. $int = apply_filters( 'jpeg_quality', $int, $edit_image ); 
  2.  
  3. if ( !empty( $int ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the jpeg_quality callback 
  2. function filter_jpeg_quality( $int, $edit_image ) { 
  3. // make filter magic happen here... 
  4. return $int
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'jpeg_quality', 'filter_jpeg_quality', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'jpeg_quality', 'filter_jpeg_quality', 10, 2 ); 

Defined (2)

The filter is defined in the following location(s).

/wp-admin/includes/image-edit.php  
  1. return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) ); 
/wp-includes/class-wp-image-editor.php  
  1. $quality = apply_filters( 'jpeg_quality', $quality, 'image_resize' );