Slaven Rezić > WE_Framework-0.097_03 > WE_Frontend::TextImages

Download:
WE_Framework-0.097_03.tar.gz

Dependencies

Annotate this POD

Module Version: 1.05   Source  

NAME ^

WE_Frontend::TextImages - create text images

SYNOPSIS ^

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

DESCRIPTION ^

This module contains function for creating images with text.

text2gif

text2gif is a function to create a text image file. The following options are supported:

-o filename

If specified, the put the generated GIF file into the filename. Otherwise the image is available in the return value (see below).

-c color

Text color as rrggbb. Example: 'FF0000' for full red. Default: '000000' (black).

-b color

Background color as rrggbb. Default: 'FFFFFF' (white).

-f file.ttf

Font file (e.g. timesbd.ttf). There is no default.

-s size

Font size in pixels. Default: '16'.

-l pixels

Leading (distance from left border) in pixels.

-bl pixels

Size of left border. Default: 0.

-bt pixels

Size of top border. Default: 0.

-br pixels

Size of right border. Default: 0.

-bb pixels

Size of bottom border. Default:0.

-width pixels

Width of the generated picture. This is optional, normally the width is calculated by the text width and used borders.

-height pixels

Height of the generated picture. This is optional, normally the height is calculated by the text height and used borders.

-text text

The generated text.

RETURN VALUE

The function returns a hash with the following keys:

Image

(Only if -o is not specified). The GIF image as a string.

Bounds

An array of the bounding coordinates. See the getBounds method in GD for the exact format.

REQUIREMENTS ^

The GD module with GIF support. Alternatively GD with PNG support and GD::Convert can also work.

CAVEATS ^

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:

    BEGIN { $ENV{PATH} .= ":/usr/local/bin" }
    use WE_Frontend::TextImages qw(text2gif);

AUTHOR ^

Slaven Rezic - slaven@rezic.de

SEE ALSO ^

syntax highlighting: