1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-12 08:54:03 +02:00

added blur method

This commit is contained in:
Oliver Vogel
2013-04-18 17:59:37 +02:00
parent 61a73c78bf
commit 67de855f10
2 changed files with 23 additions and 0 deletions

View File

@@ -1147,6 +1147,21 @@ class Image
return $this; return $this;
} }
/**
* Apply blur filter on the current image
*
* @param integer $amount
* @return Image
*/
public function blur($amount = 1)
{
for ($i=0; $i < intval($amount); $i++) {
imagefilter($this->resource, IMG_FILTER_GAUSSIAN_BLUR);
}
return $this;
}
/** /**
* Reset to original image resource * Reset to original image resource
* *

View File

@@ -1004,6 +1004,14 @@ class ImageTest extends PHPUnit_Framework_Testcase
$this->assertEquals('#000000', $img->pickColor(0, 0, 'hex')); $this->assertEquals('#000000', $img->pickColor(0, 0, 'hex'));
} }
public function testBlurImage()
{
$img = Image::make('public/tile.png')->blur();
$this->assertInstanceOf('Intervention\Image\Image', $img);
$this->assertEquals('#b4e000', $img->pickColor(0, 0, 'hex'));
$this->assertEquals('#98bc18', $img->pickColor(0, 7, 'hex'));
}
public function testFillImage() public function testFillImage()
{ {
$img = new Image(null, 32, 32); $img = new Image(null, 32, 32);