- Модуль: ldap
- Путь к файлу: ~/bitrix/modules/ldap/classes/general/ldap_util.php
- Класс: CLdapUtil
- Вызов: CLdapUtil::GetImgTypeBySignature
static function GetImgTypeBySignature($signature)
{
if($signature == "")
return false;
$signature = mb_substr($signature, 0, 12);
$arSigs = array(
"GIF" => "gif",
"xffxd8xff" => "jpg",
"x89x50x4e" => "png",
"FWS" => "swf",
"CWS" => "swc",
"8BPS" => "psd",
"BM" => "bmp",
"xffx4fxff" => "jpc",
"IIx2ax00" => "tif",
"MMx00x2a" => "tif",
"FORM" => "iff",
"x00x00x01x00" => "ico",
"x0dx0ax87x0a" => "jp2"
);
foreach ($arSigs as $sig => $type)
if(preg_match("/^".$sig."/x", $signature))
return $type;
return false;
}