getImage($image_id, $type, $lang, $version); $image = $imageClass->createThumbnail($image); return $imageClass->outputImage($image); } catch (\UnexpectedValueException $e) { throw new NotFoundHttpException('Unknown image'); } } #[Route(path: '/photos/original/{photoId}/{hash}/', requirements: ['photoId' => '\d+', 'hash' => '\S+'])] public function photosOriginal(ImageLocator $imageLocator, int $photoId, string $hash): BinaryFileResponse { if (!($image = $imageLocator->getImageById($photoId))) { throw new NotFoundHttpException('Photo not found'); } if ($image->getHash() !== $hash) { throw new NotFoundHttpException('Invalid photo hash!'); } if (!file_exists($image->getImagePath())) { throw new NotFoundHttpException('Photo was not found on disk: '.$image->getImagePath()); } return new BinaryFileResponse($image->getImagePath()); } }