aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/upload.php4
-rw-r--r--lib/resize.php3
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;
}