From: Andrew Dolgov Date: Sun, 31 Mar 2013 05:49:36 +0000 (+0400) Subject: image.php: replace file_get_contents() with a fread/print loop X-Git-Tag: 1.7.6~121 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=2f6ee35483a2cf7214e4cd06569a350fe6c2982c;p=tt-rss.git image.php: replace file_get_contents() with a fread/print loop --- diff --git a/image.php b/image.php index 36da375a..60f2cc83 100644 --- a/image.php +++ b/image.php @@ -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.";