1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-29 09:47:36 +01:00

added pixelate method

This commit is contained in:
Oliver Vogel 2013-01-27 12:37:54 +01:00
parent 130e95d267
commit 514ba420bc
2 changed files with 14 additions and 1 deletions

View File

@ -192,6 +192,11 @@ class Image
return $this;
}
public function pixelate($size = 10, $advanced = true)
{
imagefilter($this->resource, IMG_FILTER_PIXELATE, $size, $advanced);
}
public function reset()
{
$this->setProperties($this->dirname .'/'. $this->basename);

View File

@ -101,6 +101,14 @@ class ImageTest extends PHPUnit_Framework_Testcase
}
public function testPixelateImage()
{
$img = $this->getTestImage();
$img->pixelate(20);
$img->save('public/pixels.jpg');
$this->assertInstanceOf('Intervention\Image\Image', $img);
}
public function testResetImage()
{
$img = $this->getTestImage();
@ -114,7 +122,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
public function testSaveImage()
{
$save_as = 'public/test.jpg';
$save_as = 'public/test2.jpg';
$img = $this->getTestImage();
$img->save($save_as);
$this->assertFileExists($save_as);