diff options
author | Richard Beales <[email protected]> | 2013-03-19 18:19:07 +0000 |
---|---|---|
committer | Richard Beales <[email protected]> | 2013-03-19 18:19:07 +0000 |
commit | 05809dfdf7cbf7699be6408c0f49d325585726b5 (patch) | |
tree | bfa33dcd1cf8707e65a05df98d27d563396520d2 /image.php | |
parent | 1d707e9f03d1a654e0807aadce7ab790befd0b95 (diff) | |
parent | 2229e6ed6b07d4a28b04689a21c645bdb83652f7 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'image.php')
-rw-r--r-- | image.php | 35 |
1 files changed, 28 insertions, 7 deletions
@@ -4,14 +4,35 @@ require_once "config.php"; - $url = base64_decode($_GET['url']); + // backwards compatible wrapper for old-style image caching + /* if (isset($_GET['url'])) { + $url = base64_decode($_GET['url']); - $filename = CACHE_DIR . '/images/' . sha1($url) . '.png'; + $filename = CACHE_DIR . '/images/' . sha1($url) . '.png'; - if (file_exists($filename)) { - header("Content-type: image/png"); - echo file_get_contents($filename); - } else { - header("Location: $url"); + if (file_exists($filename)) { + header("Content-type: image/png"); + echo file_get_contents($filename); + } else { + header("Location: $url"); + } + + return; + } */ + + @$hash = basename($_GET['hash']); + + if ($hash) { + + $filename = CACHE_DIR . '/images/' . $hash . '.png'; + + if (file_exists($filename)) { + header("Content-type: image/png"); + echo file_get_contents($filename); + } else { + header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found"); + echo "File not found."; + } } + ?> |