mirror of
git://develop.git.wordpress.org/
synced 2025-02-22 15:42:29 +01: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:
parent
af40e9aa5f
commit
bd870d997c
@ -7866,36 +7866,3 @@ function is_php_version_compatible( $required ) {
|
|||||||
function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) {
|
function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) {
|
||||||
return abs( (float) $expected - (float) $actual ) <= $precision;
|
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
|
* @since 5.7.0
|
||||||
*
|
*
|
||||||
@ -4962,3 +4962,37 @@ function wp_show_heic_upload_error( $plupload_settings ) {
|
|||||||
$plupload_settings['heic_upload_error'] = true;
|
$plupload_settings['heic_upload_error'] = true;
|
||||||
return $plupload_settings;
|
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 );
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user