X-Git-Url: https://git.cweiske.de/phancap.git/blobdiff_plain/d7074b4fa5043358df3aed0e3cc421aeb060517f..4257ca9320281606be23efac2e9a6e2ddedcb6d5:/www/get.php diff --git a/www/get.php b/www/get.php index 1da3e8a..739aaf8 100644 --- a/www/get.php +++ b/www/get.php @@ -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');