diff --git a/README.md b/README.md index 38400561..87b1a403 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Intervention Image Class -Image handling and manipulation. Made to work with **Laravel 4** but runs also standalone. +Image handling and manipulation based on PHP GD library. Made to work with **Laravel 4** but runs also standalone. ## Installation @@ -35,7 +35,7 @@ Add the facade of this package to the `$aliases` array. ... - 'Image' => 'Intervention\Image\Facades\Image', + 'Image' => 'Intervention\Image\Facades\Image' ), @@ -48,6 +48,7 @@ Add the facade of this package to the `$aliases` array. * Image::insert - Insert another image on top of the current image * Image::pixelate - Pixelate current image * Image::greyscale - Turn current image into a greyscale version +* Image::text - Write text in current image * Image::reset - Reset to original image resource * Image::save - Save image in filesystem @@ -69,6 +70,9 @@ $img->resize(array('height' => '200')); // insert another image $img->insert('public/bar.png'); +// write some text in image +$img->text('Hello World', 10, 10); + // turn image into greyscale version $img->greyscale(); diff --git a/src/Intervention/Image/Image.php b/src/Intervention/Image/Image.php index 1e747d33..c6a57a4e 100644 --- a/src/Intervention/Image/Image.php +++ b/src/Intervention/Image/Image.php @@ -311,7 +311,19 @@ class Image return $this; } - public function text($text, $pos_x = 0, $pos_y = 0, $angle = 0, $size = 16, $color = '000000', $fontfile = null) + /** + * Write text in current image + * + * @param string $text + * @param integer $pos_x + * @param integer $pos_y + * @param integer $angle + * @param integer $size + * @param string $color + * @param string $fontfile + * @return Image + */ + public function text($text, $pos_x = 0, $pos_y = 0, $size = 16, $color = '000000', $angle = 0, $fontfile = null) { if (is_null($fontfile)) { diff --git a/tests/ImageTest.php b/tests/ImageTest.php index 1b953620..4c9217b6 100644 --- a/tests/ImageTest.php +++ b/tests/ImageTest.php @@ -139,7 +139,7 @@ class ImageTest extends PHPUnit_Framework_Testcase public function testTextImage() { $img = $this->getTestImage(); - $img = $img->text('Fox', 10, 10, 0, 16, '000000', null); + $img = $img->text('Fox', 10, 10, 16, '000000', 0, null); $this->assertInstanceOf('Intervention\Image\Image', $img); }