• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/classes/general/utils.php
  • Класс: CIntranetUtils
  • Вызов: CIntranetUtils::InitImage
static function InitImage($imageID, $imageWidth, $imageHeight = 0, $type = BX_RESIZE_IMAGE_PROPORTIONAL)
{
	$imageFile = false;
	$imageImg = "";

	if(($imageWidth = intval($imageWidth)) <= 0) $imageWidth = 100;
	if(($imageHeight = intval($imageHeight)) <= 0) $imageHeight = $imageWidth;

	$imageID = intval($imageID);

	if($imageID > 0)
	{
		$imageFile = CFile::GetFileArray($imageID);
		if ($imageFile !== false)
		{
			$arFileTmp = CFile::ResizeImageGet(
				$imageFile,
				array("width" => $imageWidth, "height" => $imageHeight),
				$type,
				false
			);
			$imageImg = CFile::ShowImage($arFileTmp["src"], $imageWidth, $imageHeight, "border=0", "");
		}
	}

	return array("FILE" => $imageFile, "CACHE" => $arFileTmp, "IMG" => $imageImg);
}