From 7a90d3e7c1ed2610de5d94b260302e4a656bc083 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 30 Apr 2008 10:12:21 +0000 Subject: Fixed image resizing issue, corrected function to create a jpeg using output buffering rather than a temporary file git-svn-id: https://code.elgg.org/elgg/trunk@567 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/filestore.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'engine/lib/filestore.php') diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index c52599af5..b40baf4e7 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -516,12 +516,12 @@ $newheight = $height; if ($width > $maxwidth) { - $newwidth = $maxwidth; $newheight = floor($height * ($maxwidth / $width)); + $newwidth = $maxwidth; } if ($newheight > $maxheight) { - $newheight = $maxheight; - $newwidth = floor($newwidth * ($maxheight / $newheight)); + $newwidth = floor($newwidth * ($maxheight / $newheight)); + $newheight = $maxheight; } $accepted_formats = array( @@ -539,8 +539,10 @@ // Resize and return the image contents! imagecopyresized($newimage, $oldimage, 0,0,0,0,$newwidth,$newheight,$width,$height); - imagejpeg($newimage, $_FILES[$input_name]['tmp_name'] . $newwidth . $newheight . ".tmp", 90); - return file_get_contents($_FILES[$input_name]['tmp_name'] . $newwidth . $newheight . ".tmp"); + ob_start(); + imagejpeg($newimage, null, 90); + $jpeg = ob_get_clean(); + return $jpeg; } -- cgit v1.2.3