• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/visualconstructor/helper/util.php
  • Класс: BitrixReportVisualConstructorHelperUtil
  • Вызов: Util::getAvatarSrc
static function getAvatarSrc($avatarId, $width = 21, $height = 21)
{
	static $cache = array();

	if(empty($avatarId))
	{
		return null;
	}

	$avatarId = (int) $avatarId;
	$key = $avatarId . " $width $height";

	if (!isset($cache[$key]))
	{
		$src = false;
		if ($avatarId > 0)
		{

			$imageFile = CFile::getFileArray($avatarId);
			if ($imageFile !== false)
			{

				$fileTmp = CFile::resizeImageGet(
					$imageFile,
					array("width" => $width, "height" => $height),
					BX_RESIZE_IMAGE_EXACT,
					false
				);
				$src = $fileTmp["src"];
			}

			$cache[$key] = $src;
		}
	}

	return $cache[$key];
}