file_is_valid_image

Advertisement

Summery Summery

Validate that file is an image.

Syntax Syntax

file_is_valid_image( string $path )

Parameters Parameters

$path

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

Return Return

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

Source Source

File: wp-admin/includes/image.php

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

Advertisement

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.