WordPress at Your Fingertips
function is not described

SimplePie_Content_Type_Sniffer::image() public WP 1.0

Sniff images

{} It's a method of the class: SimplePie_Content_Type_Sniffer{}

No Hooks.

Return

String. Actual Content-Type

Usage

$SimplePie_Content_Type_Sniffer = new SimplePie_Content_Type_Sniffer();
$SimplePie_Content_Type_Sniffer->image();

Code of SimplePie_Content_Type_Sniffer::image() WP 5.8.2

public function image()
{
	if (substr($this->file->body, 0, 6) === 'GIF87a'
		|| substr($this->file->body, 0, 6) === 'GIF89a')
	{
		return 'image/gif';
	}
	elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
	{
		return 'image/png';
	}
	elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
	{
		return 'image/jpeg';
	}
	elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
	{
		return 'image/bmp';
	}
	elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
	{
		return 'image/vnd.microsoft.icon';
	}

	return false;
}