file_is_valid_image

函数


file_is_valid_image ( $path )
参数
  • (string)
    $path
    File path to test if valid image.
    Required:
返回值
  • (bool) True if valid image, false if not valid image.
定义位置
  • wp-admin/includes/image.php
    , line 959
引入
2.5.0
弃用

Validates that file is an image.

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