mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Media: Move wp_getimagesize() to wp-includes/media.php, for consistency with other media functions.
Follow-up to [50146]. See #49889. git-svn-id: https://develop.svn.wordpress.org/trunk@50148 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user