From dd44d0e40999632fb1d80f313f51b6decbfa937c Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sat, 5 Mar 2022 17:13:32 +0100 Subject: [PATCH] Further flush before download, #1297 follow-up See https://github.com/Piwigo/Piwigo/commit/db65aa51d52ec2b4bd00b2f7835770779b19579c#commitcomment-67982862 that confirms this works better. --- action.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/action.php b/action.php index aa983b78d..8e01a518b 100644 --- a/action.php +++ b/action.php @@ -210,21 +210,22 @@ else .basename($file).'";'; } -foreach ($http_headers as $header) -{ - header( $header ); -} - // Looking at the safe_mode configuration for execution time if (ini_get('safe_mode') == 0) { @set_time_limit(0); } + // Without clean and flush there may be some image download problems, or image can be corrupted after download if (ob_get_length() !== FALSE) { - ob_clean(); - flush(); + ob_flush(); +} +flush(); + +foreach ($http_headers as $header) +{ + header( $header ); } @readfile($file);