mirror of
https://github.com/Intervention/image.git
synced 2025-08-12 00:43:59 +02:00
added blur method
This commit is contained in:
@@ -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
|
||||||
*
|
*
|
||||||
|
@@ -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);
|
||||||
|
Reference in New Issue
Block a user