Ticket #11967: deprecatewp_shrink_dimensions.11967.diff
File deprecatewp_shrink_dimensions.11967.diff, 4.2 KB (added by filosofo, 5 years ago) 


wpincludes/media.php
233 233 /** 234 234 * Calculates the new dimentions for a downsampled image. 235 235 * 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 238 237 * that dimension. 239 238 * 240 239 * @since 2.5.0 
wpincludes/deprecated.php
1914 1914 _deprecated_function( __FUNCTION__, '3.0', 'wp_load_alloptions()' ); 1915 1915 return wp_load_alloptions(); 1916 1916 } 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 */ 1931 function 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 1917 1937 ?> 
wpadmin/includes/imageedit.php
453 453 $meta['file'] = _wp_relative_upload_path( $restored_file ); 454 454 $meta['width'] = $data['width']; 455 455 $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); 457 457 $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; 458 458 } 459 459 … … 598 598 $meta['width'] = imagesx($img); 599 599 $meta['height'] = imagesy($img); 600 600 601 list ( $uwidth, $uheight ) = wp_ shrink_dimensions($meta['width'], $meta['height']);601 list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96); 602 602 $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; 603 603 604 604 if ( $success && ('nothumb' == $target  'all' == $target) ) { 
wpadmin/includes/image.php
94 94 $imagesize = getimagesize( $file ); 95 95 $metadata['width'] = $imagesize[0]; 96 96 $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); 98 98 $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'"; 99 99 100 100 // Make the file path relative to the upload dir … … 169 169 * Calculated the new dimentions for a downsampled image. 170 170 * 171 171 * @since 2.0.0 172 * @see wp_ shrink_dimensions()172 * @see wp_constrain_dimensions() 173 173 * 174 174 * @param int $width Current width of the image 175 175 * @param int $height Current height of the image 176 176 * @return mixed Array(height,width) of shrunk dimensions. 177 177 */ 178 178 function get_udims( $width, $height) { 179 return wp_ shrink_dimensions( $width, $height);179 return wp_constrain_dimensions( $width, $height, 128, 96 ); 180 180 } 181 181 182 182 /** 183 * Calculates the new dimentions for a downsampled image.184 *185 * @since 2.0.0186 * @see wp_constrain_dimensions()187 *188 * @param int $width Current width of the image189 * @param int $height Current height of the image190 * @param int $wmax Maximum wanted width191 * @param int $hmax Maximum wanted height192 * @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 /**199 183 * Convert a fraction string to a decimal. 200 184 * 201 185 * @since 2.5.0