• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/controller/file.php
  • Класс: BitrixDiskControllerFile
  • Вызов: File::showPreviewAction
public function showPreviewAction(DiskFile $file, $width = 0, $height = 0, $exact = null)
{
	if (!$file->getView()->getPreviewData())
	{
		return null;
	}

	$fileName = $file->getView()->getPreviewName();
	$fileData = $file->getView()->getPreviewData();

	if (empty($fileName) || empty($fileData) || !is_array($fileData))
	{
		return null;
	}

	$response = ResponseResizedImage::createByImageData(
		$fileData,
		$width,
		$height
	);

	$response
		->setResizeType($exact === 'Y' ? BX_RESIZE_IMAGE_EXACT : BX_RESIZE_IMAGE_PROPORTIONAL)
		->setName($file->getName())
		->setCacheTime(86400)
	;

	return $response;
}