From 27824b12568256f251215f23b5c81feceb7eee83 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sat, 2 Feb 2013 18:09:19 +0100 Subject: [PATCH] readme update --- README.md | 7 +++++++ tests/ImageTest.php | 15 +++++++++++++++ 2 files changed, 22 insertions(+) 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()