From e632ce4ad04df682c4ae8d18cfbaab5866260fc2 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 20 Jan 2010 20:42:03 +0000 Subject: Resetting cropping coords for images that can't be cropped in filestore. git-svn-id: http://code.elgg.org/elgg/trunk@3816 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/filestore.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index 9e114c262..4627c93f0 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -875,6 +875,9 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight // Size checking should be done in action code, but for backward compatibility // this duplicates the previous behavior. if (!$upscale && ($height < $new_height || $width < $new_width)) { + // zero out offsets + $widthoffset = $heightoffset = 0; + // determine if we can scale it down at all // (ie, if only one dimension is too small) // if not, just use original size. @@ -885,9 +888,8 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight } elseif ($width < $new_width) { $ratio = $new_height / $height; } - - $new_height = floor($height * $ratio); - $new_width = floor($width * $ratio); + $region_height = $new_height = floor($height * $ratio); + $region_width = $new_width = floor($width * $ratio); } // load original image -- cgit v1.2.3