Source Location: /Image_Text-0.6.1/Image/Text.php
Image_Text - Advanced text maipulations in images
This is the main file of the Image_Text package. This file has to be included for usage of Image_Text.
This is a simple example script, showing Image_Text's facilities.
-------- Start example --------
$colors = array(
- => '#0d54e2',
- => '#e8ce7a',
- => '#7ae8ad'
$text = "EXTERIOR: DAGOBAH -- DAY\nWith Yoda\nstrapped to\n\nhis back, Luke climbs up one of the many thick vines that grow in the swamp until he reaches the Dagobah statistics lab. Panting heavily, he continues his exercises -- grepping, installing new packages, logging in as root, and writing replacements for two-year-old shell scripts in PHP.\nYODA: Code! Yes. A programmer's strength flows from code maintainability. But beware of Perl. Terse syntax... more than one way to do it... default variables. The dark side of code maintainability are they. Easily they flow, quick to join you when code you write. If once you start down the dark path, forever will it dominate your destiny, consume you it will.\nLUKE: Is Perl better than PHP?\nYODA: No... no... no. Orderless, dirtier, more seductive.\nLUKE: But how will I know why PHP is better than Perl?\nYODA: You will know. When your code you try to read six months from now...";
$options = array( 'canvas' => array('width'=> 600,'height'=> 600), // Generate a new image 600x600 pixel 'cx' => 300, // Set center to the middle of the canvas 'cy' => 300, 'width' => 300, // Set text box size 'height' => 300, 'line_spacing' => 1, // Normal linespacing 'angle' => 45, // Text rotated by 45 'color' => $colors, // Predefined colors 'background_color' => '#FF0000', //red background 'max_lines' => 100, // Maximum lines to render 'min_font_size' => 2, // Minimal/Maximal font size (for automeasurize) 'max_font_size' => 50, 'font_path' => './', // Settings for the font file 'font_file' => 'Vera.ttf', 'antialias' => true, // Antialiase font rendering 'halign' => IMAGE_TEXT_ALIGN_RIGHT, // Alignment to the right and middle 'valign' => IMAGE_TEXT_ALIGN_MIDDLE );
// Generate a new Image_Text object $itext = new Image_Text($text, $options);
// Initialize and check the settings $itext->init(); // Automatically determine optimal font size $itext->autoMeasurize();
// Render the image $itext->render();
// Display it $itext->display();
-------- End example --------
PHP versions 4 and 5
LICENSE: This source file is subject to version 3.0 of the PHP license that is available through the world-wide-web at the following URI: http://www.php.net/license/3_0.txt. If you did not receive a copy of the PHP License and are unable to obtain it through the web, please send a note to firstname.lastname@example.org so we can mail you a copy immediately.
IMAGE_TEXT_ALIGN_BOTTOM [line 118]
IMAGE_TEXT_ALIGN_CENTER [line 103]
IMAGE_TEXT_ALIGN_JUSTIFY [line 123]
IMAGE_TEXT_ALIGN_LEFT [line 93]
IMAGE_TEXT_ALIGN_MIDDLE [line 113]
IMAGE_TEXT_ALIGN_RIGHT [line 98]
IMAGE_TEXT_ALIGN_TOP [line 108]
IMAGE_TEXT_REGEX_HTMLCOLOR [line 88]
Documentation generated on Mon, 12 Dec 2011 14:00:02 +0000 by phpDocumentor 1.4.3
. PEAR Logo Copyright © PHP Group 2004.