file_is_valid_image( string $path )

Validate that file is an image.


Parameters Parameters

$path

(string) (Required) File path to test if valid image.


Top ↑

Return Return

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


Top ↑

Source Source

File: wp-admin/includes/image.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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