Merge branch 'MDL-81256-403' of https://github.com/marinaglancy/moodle into MOODLE_403_STABLE
This commit is contained in:
+2
-2
@@ -359,8 +359,8 @@ function resize_image_from_image($original, $imageinfo, $width, $height, $forcec
|
||||
}
|
||||
|
||||
if ($ratio < 1) {
|
||||
$targetwidth = floor($originalwidth * $ratio);
|
||||
$targetheight = floor($originalheight * $ratio);
|
||||
$targetwidth = round($originalwidth * $ratio);
|
||||
$targetheight = round($originalheight * $ratio);
|
||||
} else {
|
||||
// Do not enlarge the original file if it is smaller than the requested thumbnail size.
|
||||
$targetwidth = $originalwidth;
|
||||
|
||||
@@ -87,7 +87,7 @@ class gdlib_test extends \basic_testcase {
|
||||
$newpng = resize_image($pngpath, null, 24);
|
||||
$this->assertTrue(is_string($newpng));
|
||||
$imageinfo = getimagesizefromstring($newpng);
|
||||
$this->assertEquals(89, $imageinfo[0]);
|
||||
$this->assertEquals(90, $imageinfo[0]);
|
||||
$this->assertEquals(24, $imageinfo[1]);
|
||||
$this->assertEquals('image/png', $imageinfo['mime']);
|
||||
|
||||
@@ -96,7 +96,7 @@ class gdlib_test extends \basic_testcase {
|
||||
$this->assertTrue(is_string($newpng));
|
||||
$imageinfo = getimagesizefromstring($newpng);
|
||||
$this->assertEquals(100, $imageinfo[0]);
|
||||
$this->assertEquals(26, $imageinfo[1]);
|
||||
$this->assertEquals(27, $imageinfo[1]);
|
||||
$this->assertEquals('image/png', $imageinfo['mime']);
|
||||
|
||||
// Preferred width and height.
|
||||
@@ -121,7 +121,7 @@ class gdlib_test extends \basic_testcase {
|
||||
$newpng = resize_image_from_image($imageresource, $origimageinfo, null, 24);
|
||||
$this->assertTrue(is_string($newpng));
|
||||
$imageinfo = getimagesizefromstring($newpng);
|
||||
$this->assertEquals(89, $imageinfo[0]);
|
||||
$this->assertEquals(90, $imageinfo[0]);
|
||||
$this->assertEquals(24, $imageinfo[1]);
|
||||
$this->assertEquals('image/png', $imageinfo['mime']);
|
||||
|
||||
@@ -131,7 +131,7 @@ class gdlib_test extends \basic_testcase {
|
||||
$this->assertTrue(is_string($newpng));
|
||||
$imageinfo = getimagesizefromstring($newpng);
|
||||
$this->assertEquals(100, $imageinfo[0]);
|
||||
$this->assertEquals(26, $imageinfo[1]);
|
||||
$this->assertEquals(27, $imageinfo[1]);
|
||||
$this->assertEquals('image/png', $imageinfo['mime']);
|
||||
|
||||
// Preferred width and height.
|
||||
|
||||
Reference in New Issue
Block a user