- Модуль: intranet
- Путь к файлу: ~/bitrix/modules/intranet/classes/general/utils.php
- Класс: CIntranetUtils
- Вызов: CIntranetUtils::createAvatar
static function createAvatar($fields, $params = array(), $siteId = SITE_ID)
{
if(!isset($params['AVATAR_SIZE']))
{
$params['AVATAR_SIZE'] = 100;
}
if (CModule::IncludeModule('socialnetwork'))
{
return CSocNetLogTools::FormatEvent_CreateAvatar($fields, $params, '', $siteId);
}
static $cachedAvatars = array();
if (intval($fields['PERSONAL_PHOTO']) > 0)
{
if (empty($cachedAvatars[$params['AVATAR_SIZE']][$fields['PERSONAL_PHOTO']]))
{
$imageFile = CFile::getFileArray($fields['PERSONAL_PHOTO']);
if ($imageFile !== false)
{
$file = CFile::resizeImageGet($imageFile, array(
"width" => $params['AVATAR_SIZE'],
"height" => $params['AVATAR_SIZE']
), BX_RESIZE_IMAGE_EXACT, false);
$avatarPath = $file['src'];
$cachedAvatars[$params['AVATAR_SIZE']][$fields['PERSONAL_PHOTO']] = $avatarPath;
}
}
}
return empty($cachedAvatars[$params['AVATAR_SIZE']][$fields['PERSONAL_PHOTO']])? null : $cachedAvatars[$params['AVATAR_SIZE']][$fields['PERSONAL_PHOTO']];
}