_jetpack_og_get_image_validate_size

Validate the width and height against required width and height.

Description

_jetpack_og_get_image_validate_size( $width, $height, $req_width, $req_height ); 

Parameters (4)

0. $width
Int Width of the image
1. $height
Int Height of the image
2. $req_width
Int Required width to pass validation
3. $req_height
Int Required height to pass validation

Usage

  1. if ( !function_exists( '_jetpack_og_get_image_validate_size' ) ) { 
  2. require_once '/functions.opengraph.php'; 
  3.  
  4. // int Width of the image 
  5. $width = null; 
  6.  
  7. // int Height of the image 
  8. $height = null; 
  9.  
  10. // int Required width to pass validation 
  11. $req_width = null; 
  12.  
  13. // int Required height to pass validation 
  14. $req_height = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = _jetpack_og_get_image_validate_size($width, $height, $req_width, $req_height); 
  18.  

Defined (1)

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

/functions.opengraph.php  
  1. function _jetpack_og_get_image_validate_size($width, $height, $req_width, $req_height) { 
  2. if (!$width || !$height) { 
  3. return false; 
  4.  
  5. $valid_width = ( $width >= $req_width ); 
  6. $valid_height = ( $height >= $req_height ); 
  7. $is_image_acceptable = $valid_width && $valid_height; 
  8. return $is_image_acceptable;