1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-10 16:04:04 +02:00

added greyscale method

This commit is contained in:
Oliver Vogel
2013-01-27 12:40:45 +01:00
parent 514ba420bc
commit a6143438ab
2 changed files with 17 additions and 1 deletions

View File

@@ -197,6 +197,16 @@ class Image
imagefilter($this->resource, IMG_FILTER_PIXELATE, $size, $advanced); imagefilter($this->resource, IMG_FILTER_PIXELATE, $size, $advanced);
} }
public function grayscale()
{
imagefilter($this->resource, IMG_FILTER_GRAYSCALE);
}
public function greyscale()
{
$this->grayscale();
}
public function reset() public function reset()
{ {
$this->setProperties($this->dirname .'/'. $this->basename); $this->setProperties($this->dirname .'/'. $this->basename);

View File

@@ -105,7 +105,13 @@ class ImageTest extends PHPUnit_Framework_Testcase
{ {
$img = $this->getTestImage(); $img = $this->getTestImage();
$img->pixelate(20); $img->pixelate(20);
$img->save('public/pixels.jpg'); $this->assertInstanceOf('Intervention\Image\Image', $img);
}
public function testGreyscaleImage()
{
$img = $this->getTestImage();
$img->greyscale();
$this->assertInstanceOf('Intervention\Image\Image', $img); $this->assertInstanceOf('Intervention\Image\Image', $img);
} }