file_is_valid_image( string $path )
Validate that file is an image.
Parameters
- $path
-
(string) (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
function file_is_valid_image( $path ) { $size = wp_getimagesize( $path ); return ! empty( $size ); }
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/file_is_valid_image