image_edit_before_change

Filters the GD image resource before applying changes to the image.

Description

apply_filters( 'image_edit_before_change', (resource) $image, (array) $changes ); 

Parameters (2)

0. $image (resource)
GD image resource.
1. $changes (array)
Array of change operations.

Usage

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

Defined (1)

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

/wp-admin/includes/image-edit.php  
  1. $image = apply_filters( 'image_edit_before_change', $image, $changes );