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

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

	$isImage = TypeFile::isImage($file);
	if (!$isImage)
	{
		return $this->downloadAction($file);
	}

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

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

	return $response;
}