You are here

protected function FileDownloadController::response in WebP 8

Returns an image as response.

Parameters

\Drupal\Core\Image\Image $image: The image.

array $headers: Response headers.

string $scheme: The file scheme, defaults to 'private'.

Return value

\Symfony\Component\HttpFoundation\BinaryFileResponse The transferred file as response.

1 call to FileDownloadController::response()
FileDownloadController::download in src/Controller/FileDownloadController.php
Handles private file transfers.

File

src/Controller/FileDownloadController.php, line 207

Class

FileDownloadController

Namespace

Drupal\webp\Controller

Code

protected function response($uri, array $headers, $scheme) {

  // \Drupal\Core\EventSubscriber\FinishResponseSubscriber::onRespond()
  // sets response as not cacheable if the Cache-Control header is not
  // already modified. We pass in FALSE for non-private schemes for the
  // $public parameter to make sure we don't change the headers.
  return new BinaryFileResponse($uri, 200, $headers, $scheme !== 'private');
}