WordPress.org

Make WordPress Core

Ticket #11967: deprecate-wp_shrink_dimensions.11967.diff

File deprecate-wp_shrink_dimensions.11967.diff, 4.2 KB (added by filosofo, 4 years ago)
  • wp-includes/media.php

     
    233233/** 
    234234 * Calculates the new dimentions for a downsampled image. 
    235235 * 
    236  * Same as {@link wp_shrink_dimensions()}, except the max parameters are 
    237  * optional. If either width or height are empty, no constraint is applied on 
     236 * If either width or height are empty, no constraint is applied on 
    238237 * that dimension. 
    239238 * 
    240239 * @since 2.5.0 
  • wp-includes/deprecated.php

     
    19141914        _deprecated_function( __FUNCTION__, '3.0', 'wp_load_alloptions()' ); 
    19151915        return wp_load_alloptions(); 
    19161916} 
     1917 
     1918/** 
     1919 * Calculates the new dimentions for a downsampled image. 
     1920 * 
     1921 * @since 2.0.0 
     1922 * @deprecated 3.0.0 
     1923 * @deprecated Use wp_constrain_dimensions() 
     1924 * 
     1925 * @param int $width Current width of the image 
     1926 * @param int $height Current height of the image 
     1927 * @param int $wmax Maximum wanted width 
     1928 * @param int $hmax Maximum wanted height 
     1929 * @return mixed Array(height,width) of shrunk dimensions. 
     1930 */ 
     1931function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) { 
     1932        _deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' ); 
     1933        return wp_constrain_dimensions( $width, $height, $wmax, $hmax ); 
     1934} 
     1935 
     1936 
    19171937?> 
  • wp-admin/includes/image-edit.php

     
    453453                $meta['file'] = _wp_relative_upload_path( $restored_file ); 
    454454                $meta['width'] = $data['width']; 
    455455                $meta['height'] = $data['height']; 
    456                 list ( $uwidth, $uheight ) = wp_shrink_dimensions($meta['width'], $meta['height']); 
     456                list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96); 
    457457                $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; 
    458458        } 
    459459 
     
    598598                $meta['width'] = imagesx($img); 
    599599                $meta['height'] = imagesy($img); 
    600600 
    601                 list ( $uwidth, $uheight ) = wp_shrink_dimensions($meta['width'], $meta['height']); 
     601                list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96); 
    602602                $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; 
    603603 
    604604                if ( $success && ('nothumb' == $target || 'all' == $target) ) { 
  • wp-admin/includes/image.php

     
    9494                $imagesize = getimagesize( $file ); 
    9595                $metadata['width'] = $imagesize[0]; 
    9696                $metadata['height'] = $imagesize[1]; 
    97                 list($uwidth, $uheight) = wp_shrink_dimensions($metadata['width'], $metadata['height']); 
     97                list($uwidth, $uheight) = wp_constrain_dimensions($metadata['width'], $metadata['height'], 128, 96); 
    9898                $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'"; 
    9999 
    100100                // Make the file path relative to the upload dir 
     
    169169 * Calculated the new dimentions for a downsampled image. 
    170170 * 
    171171 * @since 2.0.0 
    172  * @see wp_shrink_dimensions() 
     172 * @see wp_constrain_dimensions() 
    173173 * 
    174174 * @param int $width Current width of the image 
    175175 * @param int $height Current height of the image 
    176176 * @return mixed Array(height,width) of shrunk dimensions. 
    177177 */ 
    178178function get_udims( $width, $height) { 
    179         return wp_shrink_dimensions( $width, $height ); 
     179        return wp_constrain_dimensions( $width, $height, 128, 96 ); 
    180180} 
    181181 
    182182/** 
    183  * Calculates the new dimentions for a downsampled image. 
    184  * 
    185  * @since 2.0.0 
    186  * @see wp_constrain_dimensions() 
    187  * 
    188  * @param int $width Current width of the image 
    189  * @param int $height Current height of the image 
    190  * @param int $wmax Maximum wanted width 
    191  * @param int $hmax Maximum wanted height 
    192  * @return mixed Array(height,width) of shrunk dimensions. 
    193  */ 
    194 function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) { 
    195         return wp_constrain_dimensions( $width, $height, $wmax, $hmax ); 
    196 } 
    197  
    198 /** 
    199183 * Convert a fraction string to a decimal. 
    200184 * 
    201185 * @since 2.5.0