Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/report/lib/visualconstructor/helper/ |
Upload File : |
<?php namespace Bitrix\Report\VisualConstructor\Helper; /** * Common helper class, for some system methods * @package Bitrix\Report\VisualConstructor\Helper */ class Util { /** * Generate and return User unique id. * * @param string $prefix String to set of prefix of user unique Id. * @return string */ public static function generateUserUniqueId($prefix = '') { global $USER; $gid = ($prefix ? $prefix . '_' : '') . randString(25) . '_' . $USER->getId() . randString(8); return $gid; } /** * Get User Profile picture src by file index. * * @param int $avatarId Avatar file id. * @param int $width Width size. * @param int $height Height size. * @return mixed|null */ public 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]; } }