From c01fb90ff15170f8cab2e0f3af02765a3f0d6250 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 25 Jan 2010 18:50:01 +0000 Subject: [PATCH] Deprecate wp_shrink_dimension(), add wp-admin/includes/deprecated.php. Props filosofo. fixes #11967 git-svn-id: https://develop.svn.wordpress.org/trunk@12823 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/admin.php | 3 +++ wp-admin/includes/deprecated.php | 21 +++++++++++++++++++++ wp-admin/includes/image-edit.php | 4 ++-- wp-admin/includes/image.php | 22 +++------------------- wp-includes/media.php | 3 +-- 5 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 wp-admin/includes/deprecated.php diff --git a/wp-admin/includes/admin.php b/wp-admin/includes/admin.php index 935372c8b4..28cbae3eca 100644 --- a/wp-admin/includes/admin.php +++ b/wp-admin/includes/admin.php @@ -51,6 +51,9 @@ require_once(ABSPATH . 'wp-admin/includes/update.php'); /** WordPress Registration API */ require_once(ABSPATH . WPINC . '/registration.php'); +/** WordPress Deprecated Administration API */ +require_once(ABSPATH . 'wp-admin/includes/deprecated.php'); + /** WordPress Multi-Site support API */ if ( is_multisite() ) require_once(ABSPATH . 'wp-admin/includes/ms.php'); diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php new file mode 100644 index 0000000000..c2a201ada0 --- /dev/null +++ b/wp-admin/includes/deprecated.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index d1fdecb218..e871ae5e58 100644 --- a/wp-admin/includes/image-edit.php +++ b/wp-admin/includes/image-edit.php @@ -453,7 +453,7 @@ 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_shrink_dimensions($meta['width'], $meta['height']); + list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96); $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; } @@ -598,7 +598,7 @@ function wp_save_image($post_id) { $meta['width'] = imagesx($img); $meta['height'] = imagesy($img); - list ( $uwidth, $uheight ) = wp_shrink_dimensions($meta['width'], $meta['height']); + 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) ) { diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index e786f0f8db..019428dbd6 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -94,7 +94,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) { $imagesize = getimagesize( $file ); $metadata['width'] = $imagesize[0]; $metadata['height'] = $imagesize[1]; - list($uwidth, $uheight) = wp_shrink_dimensions($metadata['width'], $metadata['height']); + 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 @@ -169,30 +169,14 @@ function wp_load_image( $file ) { * Calculated the new dimentions for a downsampled image. * * @since 2.0.0 - * @see wp_shrink_dimensions() + * @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_shrink_dimensions( $width, $height ); -} - -/** - * Calculates the new dimentions 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 - * @param int $wmax Maximum wanted width - * @param int $hmax Maximum wanted height - * @return mixed Array(height,width) of shrunk dimensions. - */ -function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) { - return wp_constrain_dimensions( $width, $height, $wmax, $hmax ); + return wp_constrain_dimensions( $width, $height, 128, 96 ); } /** diff --git a/wp-includes/media.php b/wp-includes/media.php index 6d8c3084e8..f04f628149 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -233,8 +233,7 @@ function get_image_tag($id, $alt, $title, $align, $size='medium') { /** * Calculates the new dimentions for a downsampled image. * - * Same as {@link wp_shrink_dimensions()}, except the max parameters are - * optional. If either width or height are empty, no constraint is applied on + * If either width or height are empty, no constraint is applied on * that dimension. * * @since 2.5.0