1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-31 01:29:51 +02:00

added text method

This commit is contained in:
Oliver Vogel
2013-02-01 17:04:58 +01:00
parent 2c23bcb430
commit 0981553edc
3 changed files with 20 additions and 4 deletions

View File

@@ -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();

View File

@@ -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)) {

View File

@@ -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);
}