1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-11 16:34:00 +02: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; return $this;
} }
public function pixelate($size = 10, $advanced = true)
{
imagefilter($this->resource, IMG_FILTER_PIXELATE, $size, $advanced);
}
public function reset() public function reset()
{ {
$this->setProperties($this->dirname .'/'. $this->basename); $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() public function testResetImage()
{ {
$img = $this->getTestImage(); $img = $this->getTestImage();
@@ -114,7 +122,7 @@ class ImageTest extends PHPUnit_Framework_Testcase
public function testSaveImage() public function testSaveImage()
{ {
$save_as = 'public/test.jpg'; $save_as = 'public/test2.jpg';
$img = $this->getTestImage(); $img = $this->getTestImage();
$img->save($save_as); $img->save($save_as);
$this->assertFileExists($save_as); $this->assertFileExists($save_as);