From 2f6ee35483a2cf7214e4cd06569a350fe6c2982c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 31 Mar 2013 09:49:36 +0400 Subject: [PATCH] image.php: replace file_get_contents() with a fread/print loop --- image.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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."; -- 2.39.5