WordPress at a glance
function is not described

file_is_valid_image() WP 2.5.0

Validate that file is an image.

No Hooks.


true/false. True if valid image, false if not valid image.


file_is_valid_image( $path );
$path(string) (required)
File path to test if valid image.

Code of file is valid image: wp-admin/includes/image.php WP 5.2.2

function file_is_valid_image( $path ) {
	$size = @getimagesize( $path );
	return ! empty( $size );