Apache-Wyrd

 view release on metacpan or  search on metacpan

Wyrd/Site/GDButton.pm  view on Meta::CPAN

package Apache::Wyrd::Site::GDButton;
use strict;
our $VERSION = '0.98';
use base qw(Apache::Wyrd::Interfaces::Setter Apache::Wyrd::Site::Widget Apache::Wyrd);
use Apache::Wyrd::Services::SAK qw(:file token_parse);
use Apache::Util;
use Digest::SHA qw(sha1_hex);
use GD;

=pod

=head1 Apache::Wyrd::Site::GDButton - Auto-generated buttons/text graphics

A wyrd to generate rectangular buttons using the GD library.

=head1 SYNOPSIS

	<BASENAME::GDButton name="pushme" src="/img/pushbutton.gif" />

=head1 DESCRIPTION

GDButton produces a rectangular button with given text using the GD library.
 It can produce either image input or img tags, as requested.

GDButton uses it's membership in the Apache::Wyrd::Site::Widget class to
track changes and decide when the output file should be regenerated.  Note:
GDButton internally draws itself at 5x the regular size and scales down in
order to make a more aesthetically pleasing final result.

=head2 HTML ATTRIBUTES

=over

=item src

File attribute.  Must be absolute, relative, or root-dir-relative.  Will
seek through those options to find a writeable location and set the HTML
attribute of the same to reflect the location of the output file.  This file
must end in either .png or .gif.  The format of the output file will be
determined by this file extension.

=item template

What file to use as a base image for this button.  It is located in the same way
the src file is.  The file can be a GIF or PNG file (it will need to have the
right file extension of .gif or .png, case insensitive).  The template file is
copied to memory and then written to the file area indicated by the src
attribute.

=item width, height

(required w/o template) in pixels.

=item bgcolor, color

(required w/o template) background and foreground color, in six-digit hex form
(#RRGGBB).

=item size

Font size, in pixels.

=item font

Path to the font file.  Either absolute, relative, or root-dir-relative.  It
must be a TrueType font file, and your version of GD must support TrueType
fonts.

=item margin, tmargin, rmargin, bmargin, lmargin

Margin between text and edge of button, in pixels.  Margin represents an
overall number, and is the default for the others.  Specific top, right,
bottom, and left margins can be defined separately, falling back to the
margin value.

=item name id action method alt align onmouseover onmouseout onclick border ismap longdesc usemap

Regular image attributes.  Passed to the HTML untouched.

=back

=head2 FLAGS

=over

=item noantialias



( run in 1.528 second using v1.01-cache-2.11-cpan-39bf76dae61 )