From cbacd1dc4c9debebf79a44c4a70747cb7baec207 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 21 Jun 2009 12:07:38 +0000 Subject: final tweaks of gd upload code --- actions/upload.php | 4 ++-- lib/resize.php | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/actions/upload.php b/actions/upload.php index a297128c4..1b8776075 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -116,8 +116,8 @@ $mem_avail = rtrim($mem_avail, 'M'); $mem_avail = $mem_avail * 1024 * 1024; if ($image_lib == 'GD') { - $mem_required = 5 * $imginfo[0] * $imginfo[1]; - $mem_avail = $mem_avail - memory_get_peak_usage() - 4194304; // 4 MB buffer + $mem_required = ceil(5.35 * $imginfo[0] * $imginfo[1]); + $mem_avail = $mem_avail - memory_get_peak_usage() - 2097152; // 2 MB buffer if ($mem_required > $mem_avail) { array_push($not_uploaded, $sent_file['name']); array_push($error_msgs, elgg_echo('tidypics:image_pixels')); diff --git a/lib/resize.php b/lib/resize.php index 9db81f318..7c06b28c5 100644 --- a/lib/resize.php +++ b/lib/resize.php @@ -185,6 +185,9 @@ break; } + imagedestroy($newimage); + imagedestroy($oldimage); + return $rtn_code; } -- cgit v1.2.3