file_is_valid_image( string $path ): bool

Validates that file is an image.


Parameters

$path string Required
File path to test if valid image.

Top ↑

Return

bool True if valid image, false if not valid image.


Top ↑

Source

File: wp-admin/includes/image.php. View all references

function file_is_valid_image( $path ) {
	$size = wp_getimagesize( $path );
	return ! empty( $size );
}


Top ↑

Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.