Remove 'hwstring_small' from attachment metadata and deprecate get_udims(). props SergeyBiryukov. fixes #21518.

git-svn-id: https://develop.svn.wordpress.org/trunk@21808 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-09-11 01:38:26 +00:00
parent 26bd73ddd1
commit 1e270f44a4
3 changed files with 16 additions and 21 deletions

View File

@ -54,6 +54,22 @@ function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
}
/**
* Calculated the new dimensions for a downsampled image.
*
* @since 2.0.0
* @deprecated 3.5.0
* @see wp_constrain_dimensions()
*
* @param int $width Current width of the image
* @param int $height Current height of the image
* @return mixed Array(height,width) of shrunk dimensions.
*/
function get_udims( $width, $height ) {
_deprecated_function( __FUNCTION__, '3.5', 'wp_constrain_dimensions()' );
return wp_constrain_dimensions( $width, $height, 128, 96 );
}
/**
* {@internal Missing Short Description}}
*

View File

@ -414,8 +414,6 @@ function wp_restore_image($post_id) {
$meta['file'] = _wp_relative_upload_path( $restored_file );
$meta['width'] = $data['width'];
$meta['height'] = $data['height'];
list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96);
$meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
}
foreach ( $default_sizes as $default_size ) {
@ -559,9 +557,6 @@ function wp_save_image($post_id) {
$meta['width'] = imagesx($img);
$meta['height'] = imagesy($img);
list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96);
$meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
if ( $success && ('nothumb' == $target || 'all' == $target) ) {
$sizes = get_intermediate_image_sizes();
if ( 'nothumb' == $target )

View File

@ -117,8 +117,6 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
$imagesize = getimagesize( $file );
$metadata['width'] = $imagesize[0];
$metadata['height'] = $imagesize[1];
list($uwidth, $uheight) = wp_constrain_dimensions($metadata['width'], $metadata['height'], 128, 96);
$metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
// Make the file path relative to the upload dir
$metadata['file'] = _wp_relative_upload_path($file);
@ -160,20 +158,6 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
}
/**
* Calculated the new dimensions for a downsampled image.
*
* @since 2.0.0
* @see wp_constrain_dimensions()
*
* @param int $width Current width of the image
* @param int $height Current height of the image
* @return mixed Array(height,width) of shrunk dimensions.
*/
function get_udims( $width, $height) {
return wp_constrain_dimensions( $width, $height, 128, 96 );
}
/**
* Convert a fraction string to a decimal.
*