photon_validate_image_url

Overwrite the results of the validation steps an image goes through before to be considered valid to be used by Photon.

Description

apply_filters( 'photon_validate_image_url', (bool) $true, (string) $url, (array) $parsed_url ); 

Parameters (3)

0. $true (bool)
True Is the image URL valid and can it be used by Photon. Default to true.
1. $url (string)
Image URL.
2. $parsed_url (array)
Array of information about the image.

Usage

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

Defined (1)

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

/class.photon.php  
  1. return apply_filters( 'photon_validate_image_url', true, $url, $parsed_url );