/** * @Route( * "/download/thumbnail/{hash}", * name="diamante_attachment_thumbnail_download", * requirements={"hash"="\w+"} * ) * * @param string $hash * @return BinaryFileResponse */ public function thumbnailAttachmentAction($hash) { $attachmentService = $this->get('diamante.attachment.service'); try { $file = $attachmentService->getThumbnail($hash); $attachmentDto = new AttachmentDto(); $attachmentDto->setFileName($file->getFilename()); $attachmentDto->setFilePath($file->getPathname()); $response = $this->getFileDownloadResponse($attachmentDto); return $response; } catch (\Exception $e) { $this->container->get('monolog.logger.diamante')->error(sprintf('Attachment loading failed: %s', $e->getMessage())); throw $this->createNotFoundException('Attachment not found'); } }
/** * @Route( * "/download/thumbnail/{hash}", * name="diamante_attachment_thumbnail_download", * requirements={"hash"="\w+"} * ) * * @param string $hash * @return BinaryFileResponse */ public function thumbnailAttachmentAction($hash) { $attachmentService = $this->get('diamante.attachment.service'); try { $file = $attachmentService->getThumbnail($hash); $attachmentDto = new AttachmentDto(); $attachmentDto->setFileName($file->getFilename()); $attachmentDto->setFilePath($file->getPathname()); $response = $this->getFileDownloadResponse($attachmentDto); return $response; } catch (\Exception $e) { $this->handleException($e); throw $this->createNotFoundException('Attachment not found'); } }