From c660db3ef021dfff32a0289a635842e06659244c Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 24 Jun 2008 17:57:42 +0000 Subject: Serious memory optimisation for the photo resize functions git-svn-id: https://code.elgg.org/elgg/trunk@1112 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/filestore.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'engine/lib/filestore.php') diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index dcf802cd5..25befa449 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -622,9 +622,6 @@ // Get the size information from the image if ($imgsizearray = getimagesize($input_name)) { - // Get the contents of the file - $filecontents = file_get_contents($input_name); - // Get width and height $width = $imgsizearray[0]; $height = $imgsizearray[1]; @@ -656,7 +653,7 @@ $accepted_formats = array( 'image/jpeg' => 'jpeg', 'image/png' => 'png', - 'image/gif' => 'png' + 'image/gif' => 'gif' ); // If it's a file we can manipulate ... @@ -664,7 +661,7 @@ $function = "imagecreatefrom" . $accepted_formats[$imgsizearray['mime']]; $newimage = imagecreatetruecolor($newwidth,$newheight); - + if (is_callable($function) && $oldimage = $function($input_name)) { // Crop the image if we need a square -- cgit v1.2.3