file_is_valid_image()
Validates that file is an image.
No Hooks.
Return
true|false
. True if valid image, false if not valid image.
Usage
file_is_valid_image( $path );
- $path(string) (required)
- File path to test if valid image.
Changelog
Since 2.5.0 | Introduced. |
file_is_valid_image() file is valid image code WP 6.6.2
function file_is_valid_image( $path ) { $size = wp_getimagesize( $path ); return ! empty( $size ); }