Skip to content

Instantly share code, notes, and snippets.

@alpharder
Created June 9, 2015 14:29
Show Gist options
  • Save alpharder/526e4bc0b0cb65afb984 to your computer and use it in GitHub Desktop.
Save alpharder/526e4bc0b0cb65afb984 to your computer and use it in GitHub Desktop.
diff --git a/app/functions/fn.images.php b/app/functions/fn.images.php
index 02892d2..44072fa 100644
--- a/app/functions/fn.images.php
+++ b/app/functions/fn.images.php
@@ -649,6 +649,8 @@ function fn_resize_image($src, $new_width = 0, $new_height = 0, $bg_color = '#ff
$thumbnail = $canvas;
}
+ unset($image);
+
$format = $settings['convert_to'];
if ($format === 'original') {
@@ -665,9 +667,16 @@ function fn_resize_image($src, $new_width = 0, $new_height = 0, $bg_color = '#ff
'filter' => $filter
);
- return array($thumbnail->get($format, $options), $format);
+ $return = array($thumbnail->get($format, $options), $format);
+
+ unset($thumbnail);
+ gc_collect_cycles();
+
+ return $return;
} catch (\Exception $e) {
+ gc_collect_cycles();
+
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment