• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/ui/avatar.php
  • Класс: BitrixDiskUiAvatar
  • Вызов: Avatar::getSrc
static function getSrc($avatarId, $width = 58, $height = 58)
{
	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,
					false,
					BitrixMainContext::getCurrent()->getRequest()->isAjaxRequest()
				);
				$src = $fileTmp["src"];
			}

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

	return $cache[$key];
}