• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/file.php
  • Класс: CFile
  • Вызов: CFile::_GetImgParams
static function _GetImgParams($strImage, $iSizeWHTTP=0, $iSizeHHTTP=0)
{
	global $arCloudImageSizeCache;

	$io = CBXVirtualIo::GetInstance();

	if($strImage == '')
		return false;

	$strAlt = '';
	if(intval($strImage)>0)
	{
		$db_img_arr = static::GetFileArray($strImage);
		if($db_img_arr)
		{
			$strImage = $db_img_arr["SRC"];
			$intWidth = intval($db_img_arr["WIDTH"]);
			$intHeight = intval($db_img_arr["HEIGHT"]);
			$strAlt = $db_img_arr["DESCRIPTION"];
		}
		else
		{
			return false;
		}
	}
	else
	{
		if(!preg_match("#^https?://#", $strImage))
		{
			$imageInfo = (new FileImage($io->GetPhysicalName($_SERVER["DOCUMENT_ROOT"].$strImage)))->getInfo();
			if($imageInfo)
			{
				$intWidth = $imageInfo->getWidth();
				$intHeight = $imageInfo->getHeight();
			}
			else
			{
				return false;
			}
		}
		elseif(array_key_exists($strImage, $arCloudImageSizeCache))
		{
			$intWidth = $arCloudImageSizeCache[$strImage][0];
			$intHeight = $arCloudImageSizeCache[$strImage][1];
		}
		else
		{
			$intWidth = intval($iSizeWHTTP);
			$intHeight = intval($iSizeHHTTP);
		}
	}

	return array(
		"SRC"=>$strImage,
		"WIDTH"=>$intWidth,
		"HEIGHT"=>$intHeight,
		"ALT"=>$strAlt,
	);
}