• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/logo.php
  • Класс: Bitrix\Crm\Controller\Timeline\Logo
  • Вызов: Logo::checkAndSaveFile
protected function checkAndSaveFile(string $fileContent): ?int
{
	$fileFields = \CRestUtil::saveFile($fileContent);
	if (!is_array($fileFields))
	{
		$this->addError(new Error('Invalid image', ErrorCode::INVALID_ARG_VALUE));
		return null;
	}

	$info = (new Image($fileFields['tmp_name']))->getInfo();

	if (
		!($info instanceof Info)
		|| $info->getWidth() !== self::ICON_WIDTH
		|| $info->getHeight() !== self::ICON_HEIGHT
		|| $info->getMime() !== self::ICON_MIME
	)
	{
		$this->addError(new Error(
			'Only png ' . self::ICON_WIDTH . 'px on ' . self::ICON_HEIGHT . 'px is supported',
			ErrorCode::INVALID_ARG_VALUE
		));
		return null;
	}

	return $this->saveFile($fileFields);
}