On this page
file_is_valid_image( string $path ): bool
Validates that file is an image.
Parameters
$pathstring Required-
File path to test if valid image.
Return
bool True if valid image, false if not valid image.
Source
File: wp-admin/includes/image.php. View all references
function file_is_valid_image( $path ) {
$size = wp_getimagesize( $path );
return ! empty( $size );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_getimagesize() wp-includes/media.php | Allows PHP’s getimagesize() to be debuggable when necessary. |
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/file_is_valid_image