WE_Frontend::TextImages - create text images
use WE_Frontend::TextImages qw(text2gif); text2gif(qw(-o /tmp/test.gif -c 000000 -b FFFFFF -f font.ttf -s 10 -l 0 -bl 0 -bt 0 -br 0 -bb 0 -text test_string));
This module contains function for creating images with text.
text2gif is a function to create a text image file. The following options are supported:
text2gif
If specified, the put the generated GIF file into the filename. Otherwise the image is available in the return value (see below).
Text color as rrggbb. Example: 'FF0000' for full red. Default: '000000' (black).
Background color as rrggbb. Default: 'FFFFFF' (white).
Font file (e.g. timesbd.ttf). There is no default.
Font size in pixels. Default: '16'.
Leading (distance from left border) in pixels.
Size of left border. Default: 0.
Size of top border. Default: 0.
Size of right border. Default: 0.
Size of bottom border. Default:0.
Width of the generated picture. This is optional, normally the width is calculated by the text width and used borders.
Height of the generated picture. This is optional, normally the height is calculated by the text height and used borders.
The generated text.
The function returns a hash with the following keys:
(Only if -o is not specified). The GIF image as a string.
-o
An array of the bounding coordinates. See the getBounds method in GD for the exact format.
getBounds
The GD module with GIF support. Alternatively GD with PNG support and GD::Convert can also work.
GD
Please note that the PATH variable in CGI scripts is normally crippled to something like /bin:/usr/bin. You have to add the path containing ppmtogif or convert (maybe /usr/local/bin) to make the gif conversion in GD::Convert work:
PATH
/bin:/usr/bin
ppmtogif
convert
/usr/local/bin
GD::Convert
BEGIN { $ENV{PATH} .= ":/usr/local/bin" } use WE_Frontend::TextImages qw(text2gif);
Slaven Rezic - slaven@rezic.de
To install WE::DB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WE::DB
CPAN shell
perl -MCPAN -e shell install WE::DB
For more information on module installation, please visit the detailed CPAN module installation guide.