Catalyst-View-Image-Text2Image
view release on metacpan or search on metacpan
Revision history for Catalyst-View-Image-Text2Image
0.02 2012-03-14
- testet "transparent"-Option.
- added "clear"-Option to set background-gcolor of canvas.
- Bug in parameter check in &text2image.
- check for GD::Simple and Catalyst::View in tests and PREREQ_PM.
- improved documentation and examples.
0.01 2012-03-13
Initial Release
lib/Catalyst/View/Image/Text2Image.pm view on Meta::CPAN
$c->stash->{Text2Image}->{x} = 10; # doesn't matter in this case, might be just 1
$c->stash->{Text2Image}->{y} = 45;
$c->stash->{Text2Image}->{font} = 'Times New Roman';
$c->stash->{Text2Image}->{fontsize} = '15';
$c->stash->{Text2Image}->{bgcolor} = 'black';
$c->stash->{Text2Image}->{fgcolor} = 'green';
$c->stash->{Text2Image}->{moveTo} = [0,44];
$c->stash->{Text2Image}->{angle} = -5;
$c->stash->{Text2Image}->{morph} = 1; ### Should the x value be adapted when text is too long?
$c->stash->{Text2Image}->{clear} = 1; ### define "clear" to make canvas-color = bgcolor !!
$c->stash->{Text2Image}->{transparent} = 'white'; # set color to become transparent
$c->detach('View::Image::Text2Image');
}
=item Example to process a pre-created image with GD::Simple:
(this leaves you all the possibilities of GD::Simple)
Your controller:
lib/Catalyst/View/Image/Text2Image.pm view on Meta::CPAN
Mandatory if not $c->stash->{Text2Image}->{img}
=item $c->stash->{Text2Image}->{fontsize}
The font to use for the text.
Mandatory if not $c->stash->{Text2Image}->{img}
=item MORE Options...
More GD::Simple Options are just applied by values in the stash.
Tested in this version are: bgcolor, fgcolor, moveTo, clear, transparent and angle.
Refer to examples for more informations on that.
=back
=head2 Image format
The generated images will always be produced in the PNG-Format.
=head1 SEE ALSO
lib/Catalyst/View/Image/Text2Image.pm view on Meta::CPAN
{
### MUST-values:
x => 100,
y => 20,
font => 'Times New Roman',
fontsize => 18,
string => 'Huhu..its me..your pic!',
### OPTIONAL Values:
morph => 1, # optional, will adapt x to string-width
clear => '1', # to set canvas-color=bgcolor.
transparent => 'white' # make background transparent
### other optional, GD::Simple Values:
fgcolor => 'black',
bgcolor => 'white',
angle => -5,
moveTo => [0,20] # Move pencil
}
return: GD image-Object
=cut
( run in 0.271 second using v1.01-cache-2.11-cpan-0a6323c29d9 )