aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-30 10:12:21 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-30 10:12:21 +0000
commit7a90d3e7c1ed2610de5d94b260302e4a656bc083 (patch)
tree1f24d22ae50ff55b7d98e4f4836e7d5f7fa92189
parentf23b5d473313344b8789d4c1fc7cc6d4491a6426 (diff)
downloadelgg-7a90d3e7c1ed2610de5d94b260302e4a656bc083.tar.gz
elgg-7a90d3e7c1ed2610de5d94b260302e4a656bc083.tar.bz2
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
-rw-r--r--engine/lib/filestore.php12
1 files changed, 7 insertions, 5 deletions
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;
}