summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/file_proxy.php
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2012-06-18 16:17:55 +0000
committerNathan Kinkade <nath@nkinka.de>2012-06-18 16:17:55 +0000
commit527bc809aaa6d48e7c1a7be50de31a4c3adcee90 (patch)
treefb7432e06af9191f2300af97685f235325d36f57 /modules/gallery/controllers/file_proxy.php
parentb52e834bd0bab530e98537d52b31d4b37f199739 (diff)
parentc48df3b8199802a75f30f38c6f7b3440f9fde4ca (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/controllers/file_proxy.php')
-rw-r--r--modules/gallery/controllers/file_proxy.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php
index 36c6bc2a..49aa9c5a 100644
--- a/modules/gallery/controllers/file_proxy.php
+++ b/modules/gallery/controllers/file_proxy.php
@@ -29,6 +29,13 @@
class File_Proxy_Controller extends Controller {
const ALLOW_PRIVATE_GALLERY = true;
public function __call($function, $args) {
+
+ // Force zlib compression off. Image and movie files are already compressed and
+ // recompressing them is CPU intensive.
+ if (ini_get("zlib.output_compression")) {
+ ini_set("zlib.output_compression", "Off");
+ }
+
// request_uri: gallery3/var/albums/foo/bar.jpg?m=1234
$request_uri = rawurldecode(Input::instance()->server("REQUEST_URI"));
@@ -128,7 +135,12 @@ class File_Proxy_Controller extends Controller {
// going to buffer up whatever file we're proxying (and it may be very large). This may
// affect embedding or systems with PHP's output_buffering enabled.
while (ob_get_level()) {
- ob_end_clean();
+ Kohana_Log::add("error","".print_r(ob_get_level(),1));
+ if (!@ob_end_clean()) {
+ // ob_end_clean() can return false if the buffer can't be removed for some reason
+ // (zlib output compression buffers sometimes cause problems).
+ break;
+ }
}
readfile($file);