add setup check for access rights
[phancap.git] / www / get.php
index 1da3e8a9de4b77722101196ff4a6d719972205a5..739aaf82ff6b97b443613729403e2c95cef63c1b 100644 (file)
@@ -40,8 +40,14 @@ $rep = new Repository();
 $rep->setConfig($config);
 try {
     $img = $rep->getImage($options);
-    header('HTTP/1.0 302 Found');
-    header('Location: ' . $img->getUrl());
+    if ($config->redirect) {
+        header('HTTP/1.0 302 Found');
+        header('Expires: ' . date('r', $img->getExpiryDate($options)));
+        header('Location: ' . $img->getUrl());
+    } else {
+        header('Content-type: ' . $img->getMimeType());
+        readfile($img->getPath());
+    }
 } catch (\Exception $e) {
     //FIXME: handle 404s and so properly
     header('HTTP/1.0 500 Internal Server error');