Image_Text - Advanced text manipulations in images.
Image_Text provides advanced text manipulation facilities for GD2 image generation with PHP. Simply add text clippings to your images, let the class automatically determine lines, rotate text boxes around their center or top left corner. These are only a couple of features Image_Text provides.
Set the text and options. This initializes a new Image_Text object. You must set your text here. Optionally you can set all options here using the $options parameter. If you finished switching all options you have to call the init() method first before doing anything further! See Image_Text::set() for further information.
$start = false], [int|bool
$end = false])
Auto measurize text
Automatically determines the greatest possible font size to fit the text into the text box. This method may be very resource intensive on your webserver. A good tweaking point are the $start and $end parameters, which specify the range of font sizes to search through. Anyway, the results should be cached if possible. You can optionally set $start and $end here as a parameter or the settings of the options array are used.
This will output the image to the users browser. You can use the standard IMAGETYPE_* constants to determine which image type will be generated. Optionally you can save your image to a destination you set in the options.
This method has to be called after setting the options for your Image_Text object. It initializes the canvas, normalizes some data and checks important options. Be sure to check the initialization after you switched some options. The set() method may force you to reinitialize the object.
This method makes your text fit into the defined textbox by measurizing the lines for your given font-size. You can do this manually before rendering (or use even Image_Text::autoMeasurize()) or the renderer will do measurizing automatically.
Render the text in the canvas using the given options.
This renders the measurized text or automatically measures it first. The $force parameter can be used to switch of measurizing problems (this may cause your text being rendered outside a given text box or destroy your image completely).
Optional, initially false, set true to silence measurize errors.
Using this method you can set multiple colors for your text. Use a simple numeric array to determine their order and give it to this function. Multiple colors will be cycled by the options specified 'color_mode' option. The given array will overwrite the existing color settings!
The following colors syntaxes are understood by this method:
"#ffff00" hexadecimal format (HTML style), with and without #.
"#08ffff00" hexadecimal format (HTML style) with alpha channel (08),
with and without #.
array with 'r','g','b' and (optionally) 'a' keys, using int values.
A single color or an array of colors are allowed here.