]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Resetting cropping coords for images that can't be cropped in filestore.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 20 Jan 2010 20:42:03 +0000 (20:42 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 20 Jan 2010 20:42:03 +0000 (20:42 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3816 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/filestore.php

index 9e114c262ff69d2ec1a567b473d0019fcd3187c4..4627c93f00841836764d3021ec6d7483b1a5a688 100644 (file)
@@ -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