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
This commit is contained in:
parent
56c9c4c527
commit
c01fb90ff1
@ -51,6 +51,9 @@ require_once(ABSPATH . 'wp-admin/includes/update.php');
|
|||||||
/** WordPress Registration API */
|
/** WordPress Registration API */
|
||||||
require_once(ABSPATH . WPINC . '/registration.php');
|
require_once(ABSPATH . WPINC . '/registration.php');
|
||||||
|
|
||||||
|
/** WordPress Deprecated Administration API */
|
||||||
|
require_once(ABSPATH . 'wp-admin/includes/deprecated.php');
|
||||||
|
|
||||||
/** WordPress Multi-Site support API */
|
/** WordPress Multi-Site support API */
|
||||||
if ( is_multisite() )
|
if ( is_multisite() )
|
||||||
require_once(ABSPATH . 'wp-admin/includes/ms.php');
|
require_once(ABSPATH . 'wp-admin/includes/ms.php');
|
||||||
|
21
wp-admin/includes/deprecated.php
Normal file
21
wp-admin/includes/deprecated.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates the new dimentions for a downsampled image.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
* @deprecated 3.0.0
|
||||||
|
* @deprecated Use 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 ) {
|
||||||
|
_deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' );
|
||||||
|
return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -453,7 +453,7 @@ function wp_restore_image($post_id) {
|
|||||||
$meta['file'] = _wp_relative_upload_path( $restored_file );
|
$meta['file'] = _wp_relative_upload_path( $restored_file );
|
||||||
$meta['width'] = $data['width'];
|
$meta['width'] = $data['width'];
|
||||||
$meta['height'] = $data['height'];
|
$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'";
|
$meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ function wp_save_image($post_id) {
|
|||||||
$meta['width'] = imagesx($img);
|
$meta['width'] = imagesx($img);
|
||||||
$meta['height'] = imagesy($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'";
|
$meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
|
||||||
|
|
||||||
if ( $success && ('nothumb' == $target || 'all' == $target) ) {
|
if ( $success && ('nothumb' == $target || 'all' == $target) ) {
|
||||||
|
@ -94,7 +94,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
|||||||
$imagesize = getimagesize( $file );
|
$imagesize = getimagesize( $file );
|
||||||
$metadata['width'] = $imagesize[0];
|
$metadata['width'] = $imagesize[0];
|
||||||
$metadata['height'] = $imagesize[1];
|
$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'";
|
$metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
|
||||||
|
|
||||||
// Make the file path relative to the upload dir
|
// 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.
|
* Calculated the new dimentions for a downsampled image.
|
||||||
*
|
*
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @see wp_shrink_dimensions()
|
* @see wp_constrain_dimensions()
|
||||||
*
|
*
|
||||||
* @param int $width Current width of the image
|
* @param int $width Current width of the image
|
||||||
* @param int $height Current height of the image
|
* @param int $height Current height of the image
|
||||||
* @return mixed Array(height,width) of shrunk dimensions.
|
* @return mixed Array(height,width) of shrunk dimensions.
|
||||||
*/
|
*/
|
||||||
function get_udims( $width, $height) {
|
function get_udims( $width, $height) {
|
||||||
return wp_shrink_dimensions( $width, $height );
|
return wp_constrain_dimensions( $width, $height, 128, 96 );
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,8 +233,7 @@ function get_image_tag($id, $alt, $title, $align, $size='medium') {
|
|||||||
/**
|
/**
|
||||||
* Calculates the new dimentions for a downsampled image.
|
* Calculates the new dimentions for a downsampled image.
|
||||||
*
|
*
|
||||||
* Same as {@link wp_shrink_dimensions()}, except the max parameters are
|
* If either width or height are empty, no constraint is applied on
|
||||||
* optional. If either width or height are empty, no constraint is applied on
|
|
||||||
* that dimension.
|
* that dimension.
|
||||||
*
|
*
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
|
Loading…
Reference in New Issue
Block a user