Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
avatar.php
1
<?php
9
namespace
Bitrix\Main\UI\AccessRights
;
10
11
class
Avatar
12
{
13
private
static
$cache = [];
14
15
public
static
function
getSrc
($avatarId, $width = 58, $height = 58): ?string
16
{
17
if
(empty($avatarId))
18
{
19
return
null
;
20
}
21
22
$avatarId = (int) $avatarId;
23
$key = $avatarId .
" $width $height"
;
24
25
if
(!isset(self::$cache[$key]))
26
{
27
$src =
false
;
28
if
($avatarId > 0)
29
{
30
31
$imageFile = \CFile::getFileArray($avatarId);
32
if
($imageFile !==
false
)
33
{
34
35
$fileTmp = \CFile::resizeImageGet(
36
$imageFile,
37
array(
"width"
=> $width,
"height"
=> $height),
38
BX_RESIZE_IMAGE_EXACT,
39
false
40
);
41
$src = $fileTmp[
"src"
];
42
}
43
44
self::$cache[$key] = $src;
45
}
46
}
47
48
return
self::$cache[$key];
49
}
50
}
Bitrix\Main\UI\AccessRights\Avatar
Definition
avatar.php:12
Bitrix\Main\UI\AccessRights\Avatar\getSrc
static getSrc($avatarId, $width=58, $height=58)
Definition
avatar.php:15
Bitrix\Main\UI\AccessRights
Definition
avatar.php:9
modules
main
lib
ui
accessrights
avatar.php
Создано системой
1.10.0