diff --git a/README.md b/README.md index a65333cd..b2bb8208 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,13 @@ $img->greyscale(); // pixelate image with blocksize of 25x25 pixel $img->pixelate(25); +// fill image with color +$img->fill('ccc'); // its possible to use shorthand hexcolor +$img->fill('cccccc'); // or full hexcolor code +$img->fill('#ccc'); // with or without # +$img->fill('#cccccc'); +$img->fill(array(204, 204, 204)); // or just pass the color as rgb format array + // save image in desired format $img->save('public/bar.jpg'); diff --git a/tests/ImageTest.php b/tests/ImageTest.php index 37cbfa6d..9f8c5dfd 100644 --- a/tests/ImageTest.php +++ b/tests/ImageTest.php @@ -121,6 +121,15 @@ class ImageTest extends PHPUnit_Framework_Testcase $img = $img->fill('fdf5e4'); $this->assertInstanceOf('Intervention\Image\Image', $img); + $img = $img->fill('#fdf5e4'); + $this->assertInstanceOf('Intervention\Image\Image', $img); + + $img = $img->fill('ccc'); + $this->assertInstanceOf('Intervention\Image\Image', $img); + + $img = $img->fill('#ccc'); + $this->assertInstanceOf('Intervention\Image\Image', $img); + $img = $img->fill(array(155, 155, 155), rand(1,10), rand(1,10)); $this->assertInstanceOf('Intervention\Image\Image', $img); } @@ -140,6 +149,12 @@ class ImageTest extends PHPUnit_Framework_Testcase $img = $this->getTestImage(); $img = $img->text('Fox', 10, 10, 16, '000000', 0, null); $this->assertInstanceOf('Intervention\Image\Image', $img); + + $img = $img->text('Fox', 10, 10, 16, '#000000', 0, null); + $this->assertInstanceOf('Intervention\Image\Image', $img); + + $img = $img->text('Fox', 10, 10, 16, array(155, 155, 155), 0, null); + $this->assertInstanceOf('Intervention\Image\Image', $img); } public function testRectangleImage()