Advertisements

file_is_displayable_image

Definition:
function file_is_displayable_image($path) {}

Validate that file is suitable for displaying within a web page.

Parameters

  • string $path: File path to test.

Return values

returns:True if suitable, false if not suitable.

Defined filters

  • file_is_displayable_image
    apply_filters('file_is_displayable_image', $result, $path)

Source code

function file_is_displayable_image($path) {

	$info = @getimagesize($path);

	if ( empty($info) )

		$result = false;

	elseif ( !in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) )	// only gif, jpeg and png images can reliably be displayed

		$result = false;

	else

		$result = true;



	return apply_filters('file_is_displayable_image', $result, $path);

}

1064

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: