• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/component/tools.php
  • Класс: BitrixIblockComponentTools
  • Вызов: Tools::getImageSrc
static function getImageSrc(array $image, $safe = true)
{
	$result = '';
	if (empty($image) || !isset($image['SRC']))
	{
		return $result;
	}
	$safe = ($safe === true);

	if ($safe)
	{
		if (isset($image['SAFE_SRC']))
		{
			$result = $image['SAFE_SRC'];
		}
		elseif (preg_match(self::WEB_PROTOCOL_MASK, $image['SRC']))
		{
			$result = $image['SRC'];
		}
		else
		{
			$result = MainWebUri::urnEncode($image['SRC'], 'UTF-8');
		}
	}
	else
	{
		$result = ($image['UNSAFE_SRC'] ?? $image['SRC']);
	}

	return $result;
}