get_udims

Calculated the new dimensions for a downsampled image.

Description

(array) get_udims( (int) $width, (int) $height ); 

Returns (array)

Shrunk dimensions (width, height).

Parameters (2)

0. $width (int)
Current width of the image
1. $height (int)
Current height of the image

Usage

  1. if ( !function_exists( 'get_udims' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/deprecated.php'; 
  3.  
  4. // Current width of the image 
  5. $width = -1; 
  6.  
  7. // Current height of the image 
  8. $height = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = get_udims($width, $height); 
  12.  

Defined (1)

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

/wp-admin/includes/deprecated.php  
  1. function get_udims( $width, $height ) { 
  2. _deprecated_function( __FUNCTION__, '3.5.0', 'wp_constrain_dimensions()' ); 
  3. return wp_constrain_dimensions( $width, $height, 128, 96 );