diff options
author | Andrew Dolgov <[email protected]> | 2013-03-31 09:49:36 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-03-31 09:49:36 +0400 |
commit | 2f6ee35483a2cf7214e4cd06569a350fe6c2982c (patch) | |
tree | ff38aa7daa60f3f3b051d4fda12007ca6decc7d7 | |
parent | 55bd5dec8048f741b932725607b994cc4f2abd38 (diff) |
image.php: replace file_get_contents() with a fread/print loop
-rw-r--r-- | image.php | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -30,7 +30,16 @@ header("Content-type: image/png"); $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)). " GMT"; header("Last-Modified: $stamp", true); - echo file_get_contents($filename); + + $fp = fopen($filename, "r"); + + if ($fp) { + while ($data = fread($fp, 32768)) { + print $data; + } + fclose($fp); + } + } else { header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found"); echo "File not found."; |