Media: Move `wp_getimagesize()` to `wp-includes/media.php`, for consistency with other media functions.
Follow-up to [50146]. See #49889. Built from https://develop.svn.wordpress.org/trunk@50148 git-svn-id: http://core.svn.wordpress.org/trunk@49827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f5857c6a9f
commit
aab7206ff8
|
@ -7866,36 +7866,3 @@ function is_php_version_compatible( $required ) {
|
|||
function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) {
|
||||
return abs( (float) $expected - (float) $actual ) <= $precision;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows PHP's getimagesize() to be debuggable when necessary.
|
||||
*
|
||||
* @since 5.7.0
|
||||
*
|
||||
* @param string $filename The file path.
|
||||
* @param array $imageinfo Extended image information, passed by reference.
|
||||
* @return array|false Array of image information or false on failure.
|
||||
*/
|
||||
function wp_getimagesize( $filename, &$imageinfo = array() ) {
|
||||
if (
|
||||
// Skip when running unit tests.
|
||||
! defined( 'DIR_TESTDATA' )
|
||||
&&
|
||||
// Return without silencing errors when in debug mode.
|
||||
defined( 'WP_DEBUG' ) && WP_DEBUG
|
||||
) {
|
||||
return getimagesize( $filename, $imageinfo );
|
||||
}
|
||||
|
||||
/**
|
||||
* Silencing notice and warning is intentional.
|
||||
*
|
||||
* getimagesize() has a tendency to generate errors, such as "corrupt JPEG data: 7191 extraneous bytes before
|
||||
* marker", even when it's able to provide image size information.
|
||||
*
|
||||
* See https://core.trac.wordpress.org/ticket/42480
|
||||
*
|
||||
* phpcs:ignore WordPress.PHP.NoSilencedErrors
|
||||
*/
|
||||
return @getimagesize( $filename, $imageinfo );
|
||||
}
|
||||
|
|
|
@ -1628,7 +1628,7 @@ function wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id =
|
|||
}
|
||||
|
||||
/**
|
||||
* Filter the 'wp_image_src_get_dimensions' value.
|
||||
* Filters the 'wp_image_src_get_dimensions' value.
|
||||
*
|
||||
* @since 5.7.0
|
||||
*
|
||||
|
@ -4962,3 +4962,37 @@ function wp_show_heic_upload_error( $plupload_settings ) {
|
|||
$plupload_settings['heic_upload_error'] = true;
|
||||
return $plupload_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows PHP's getimagesize() to be debuggable when necessary.
|
||||
*
|
||||
* @since 5.7.0
|
||||
*
|
||||
* @param string $filename The file path.
|
||||
* @param array $imageinfo Extended image information, passed by reference.
|
||||
* @return array|false Array of image information or false on failure.
|
||||
*/
|
||||
function wp_getimagesize( $filename, &$imageinfo = array() ) {
|
||||
if (
|
||||
// Skip when running unit tests.
|
||||
! defined( 'DIR_TESTDATA' )
|
||||
&&
|
||||
// Return without silencing errors when in debug mode.
|
||||
defined( 'WP_DEBUG' ) && WP_DEBUG
|
||||
) {
|
||||
return getimagesize( $filename, $imageinfo );
|
||||
}
|
||||
|
||||
/*
|
||||
* Silencing notice and warning is intentional.
|
||||
*
|
||||
* getimagesize() has a tendency to generate errors, such as
|
||||
* "corrupt JPEG data: 7191 extraneous bytes before marker",
|
||||
* even when it's able to provide image size information.
|
||||
*
|
||||
* See https://core.trac.wordpress.org/ticket/42480
|
||||
*
|
||||
* phpcs:ignore WordPress.PHP.NoSilencedErrors
|
||||
*/
|
||||
return @getimagesize( $filename, $imageinfo );
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.7-alpha-50147';
|
||||
$wp_version = '5.7-alpha-50148';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue