• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Field/Photo.php
  • Класс: Bitrix\Crm\Field\Photo
  • Вызов: Photo::createPhotoFromFace
private function createPhotoFromFace(int $faceId, int $faceFileId): ?int
{
	$fileUploader = Container::getInstance()->getFileUploader();

	$relativePath = $fileUploader->getFilePath($faceFileId);
	if (!$relativePath)
	{
		return null;
	}
	$absolutePath = Path::convertSiteRelativeToAbsolute($relativePath);

	$file = new File($absolutePath);
	if (!$file->isExists())
	{
		return null;
	}

	$photoFileArray = [
		'name' => 'face_' . $faceId . '.jpg',
		'type' => 'image/jpeg',
		'content' => $file->getContents(),
	];

	return $fileUploader->saveFileTemporary($this, $photoFileArray);
}