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:
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
Reference in New Issue
Block a user