• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/note/source/parser.php
  • Класс: BitrixLandingNoteSourceParser
  • Вызов: Parser::getImgContent
static function getImgContent($attacheId, array $files = []): ?array
{
	if (isset($files[$attacheId]))
	{
		$fileItem = $files[$attacheId];
		$file = CFile::getFileArray($fileItem['file_id']);
		if (strpos($file['CONTENT_TYPE'], 'image/') === 0)
		{
			$fileIO = new BitrixMainIOFile(
				Manager::getDocRoot() . $file['SRC']
			);
			if ($fileIO->isExists())
			{
				$newFile = Manager::savePicture([
					$fileItem['file_name'],
					base64_encode($fileIO->getContents())
				]);
				if ($newFile)
				{
					return [
						'id' => $newFile['ID'],
						'src' => File::getFilePath($newFile['ID'])
					];
				}
			}
		}
	}

	return null;
}