1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-01 01:51:43 +02:00

psr fixes

This commit is contained in:
Oliver Vogel
2013-02-24 20:07:30 +01:00
parent f93b3b571c
commit 5f2456ee7c
2 changed files with 9 additions and 9 deletions

View File

@@ -188,7 +188,7 @@ class Image
* *
* Width and height are optional, the not given parameter is calculated * Width and height are optional, the not given parameter is calculated
* based on the given. The ratio boolean decides whether the resizing * based on the given. The ratio boolean decides whether the resizing
* should keep the image ratio. You can also pass along a boolean to * should keep the image ratio. You can also pass along a boolean to
* prevent the image from being upsized. * prevent the image from being upsized.
* *
* @param integer $width The target width for the image * @param integer $width The target width for the image
@@ -219,12 +219,12 @@ class Image
if ( ! is_null($width) && ! is_null($height)) { if ( ! is_null($width) && ! is_null($height)) {
// First, calculate the height. // First, calculate the height.
$height = intval($width / $this->width * $this->height); $height = intval($width / $this->width * $this->height);
// If the height is too large, set it to the maximum // If the height is too large, set it to the maximum
// height and calculate the width. // height and calculate the width.
if ($height > $max_height) { if ($height > $max_height) {
$height = $max_height; $height = $max_height;
$width = intval($height / $this->height * $this->width); $width = intval($height / $this->height * $this->width);
} }
} }
@@ -267,12 +267,12 @@ class Image
throw new Exception('width or height needs to be defined'); throw new Exception('width or height needs to be defined');
} }
// If only the width hasn't been set, keep the current width. // If only the width hasn't been set, keep the current width.
else if (is_null($width) ) { else if (is_null($width) ) {
$width = $this->width; $width = $this->width;
} }
// If only the height hasn't been set, keep the current height. // If only the height hasn't been set, keep the current height.
else if (is_null($height) ) { else if (is_null($height) ) {
$height = $this->height; $height = $this->height;
} }
@@ -283,7 +283,7 @@ class Image
/** /**
* Legacy method to support old resizing calls * Legacy method to support old resizing calls
* *
* @param array $dimensions * @param array $dimensions
* @return Image * @return Image
*/ */

View File

@@ -80,7 +80,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
$this->assertInternalType('int', $img->width); $this->assertInternalType('int', $img->width);
$this->assertInternalType('int', $img->height); $this->assertInternalType('int', $img->height);
$this->assertEquals($img->width, 800); $this->assertEquals($img->width, 800);
$this->assertEquals($img->height, 600); $this->assertEquals($img->height, 600);
// test dominant width for auto-resizing // test dominant width for auto-resizing
$img = $this->getTestImage(); $img = $this->getTestImage();
@@ -88,7 +88,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
$this->assertInternalType('int', $img->width); $this->assertInternalType('int', $img->width);
$this->assertInternalType('int', $img->height); $this->assertInternalType('int', $img->height);
$this->assertEquals($img->width, 1000); $this->assertEquals($img->width, 1000);
$this->assertEquals($img->height, 750); $this->assertEquals($img->height, 750);
// Test image upsizing. // Test image upsizing.
$img = $this->getTestImage(); $img = $this->getTestImage();