summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/FileViewerController.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/Controller/FileViewerController.php b/app/Controller/FileViewerController.php
index 518f5b0b..3e0182ba 100644
--- a/app/Controller/FileViewerController.php
+++ b/app/Controller/FileViewerController.php
@@ -83,6 +83,31 @@ class FileViewerController extends BaseController
}
/**
+ * Display file in browser
+ *
+ * @access public
+ */
+ public function browser()
+ {
+ $file = $this->getFile();
+ $etag = md5($file['path']);
+ $this->response->withContentType($this->helper->file->getBrowserViewType($file['name']));
+ $this->response->withCache(5 * 86400, $etag);
+
+ if ($this->request->getHeader('If-None-Match') === '"'.$etag.'"') {
+ $this->response->status(304);
+ } else {
+
+ try {
+ $this->response->send();
+ $this->objectStorage->output($file['path']);
+ } catch (ObjectStorageException $e) {
+ $this->logger->error($e->getMessage());
+ }
+ }
+ }
+
+ /**
* Display image thumbnail
*
* @access public