Download the PHP package ghostff/php-text-to-image without Composer
On this page you can find all versions of the php package ghostff/php-text-to-image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ghostff/php-text-to-image
More information about ghostff/php-text-to-image
Files in ghostff/php-text-to-image
Package php-text-to-image
Short Description Add text to an existing or new image
License MIT
Informations about the package php-text-to-image
PHP-add-text-to-image
Add text to an existing or new image. PHP >= 7.0
Usage
Writing to existing image
Writing to a new image:
TextToImage
Documentations
TextToImage::__construct(string $from = '')
Description: Creates TextToImage instance.
Params | Description |
---|---|
from | The image text will be added to. If not specified a blank image 200x200 will be created |
TextToImage::setDimension(int $width, int $height): TextToImage
Description: Set background image dimension. Note: This is not evaluated if $from
argument is passed to the constructor
Params | Description |
---|---|
width | The width of the background image. |
height | The height of the background image. |
TextToImage::setBackgroundColor(int $r = 255, int $g = 255, int $b = 255, int $a = 255): TextToImage
Description: Set the background color of created background image. Note: This is not evaluated if $from
argument is passed to the constructor.
Params | Description |
---|---|
r | Value of red component. |
g | Value of green component. |
b | Value of blue component. |
a | A value between 0 and 255. 255 indicates completely opaque while 0 indicates completely transparent. |
TextToImage::addTexts(Text $text, Text ...$texts): TextToImage
Description: Adds text to specified or generated background image.
Params | Description |
---|---|
text | Text to add to image |
texts | Further Text to add to image |
Multiple text can all be added at once or over steps.
TextToImage::render(string $save_as = null, string $ext = null): string
Description: Renders modified image to a file or return contents.
Params | Description |
---|---|
save_as | If specified, image content will be saved at the provided path.. |
ext | Image processor. possible values: jpg , jpeg , png or gif . |
Text
Documentations
Text::__construct(string $from = '')
or Text::__from(string $text): Text
Description: Creates Text instance.
Params | Description |
---|---|
text | The text that will be written on image. |
Text::position(int $x, int $y = 0): Text
Description: Sets the position of specified text on image.
Params | Description |
---|---|
x | The X position. |
y | The Y position. |
Text::font(int $size, string $path = null): Text
Description: Sets the font/size of specified text.
Params | Description |
---|---|
size | The font size of text. |
path | The path to font file. |
Text::color(int $r = 255, int $g = 255, int $b = 255, int $a = 255): Text
Description: Sets the color of specified text.
Params | Description |
---|---|
r | Value of red component. |
g | Value of green component. |
b | Value of blue component. |
a | A value between 0 and 255. 255 indicates completely opaque while 0 indicates completely transparent. |
Text::shadow(int $position_x = null, int $position_y = null, array $color = []): Text
Description: Adds shadow to specified text.
Params | Description |
---|---|
position_x | The shadow's X position. |
position_y | The shadow's Y position. |
color | Array [r(red), g(green), b(blue), a(alpha)] See color method. |
Text::rotate(float $degrees): Text
Description: Rotates specified text to a specific angle.
Params | Description |
---|---|
degrees | The angle in degrees. |
Text::update(Closure $closure): Text
Description: Runtime text update.
Params | Description |
---|---|
degrees | The function to call before render. If specified, this closure will be called with three arguments TextToImage , Text and GdFont |
All versions of php-text-to-image with dependencies
ext-gd Version *