NAME
HTML::Template::Compiled::Plugin::InlineImage - XML-Escaping for HTC
SYNOPSIS
The Perl code:
use HTML::Template::Compiled::Plugin::InlineImage;
my $htc = HTML::Template::Compiled->new(
plugin => [qw(HTML::Template::Compiled::Plugin::InlineImage)],
filename => "template.htc",
tagstyle => [qw(+tt)],
);
$htc->param(gd_object => $gd);
print $htc->output;
The Template:
<html>
<body>
<img src="[%= gd_object escape="INLINE_IMG" %]" alt="[Rendered GD Image]">
</body>
</html>
DESCRIPTION
This is a plugin for HTML::Template::Compiled. If you feed it GD-objects (other image-object-types could be added in the future), then it will render the object like described in RFC 2397 (http://www.ietf.org/rfc/rfc2397.txt).
ESCAPE TYPES
There are four escapy types at the moment:
- INLINE_IMG_PNG
-
renders as png
- INLINE_IMG_GIF
-
renders as gif
- INLINE_IMG_JPEG
-
renders as jpeg
- INLINE_IMG
-
renders as png
METHODS
- register
-
gets called by HTC
SUBROUTINES
- inline
-
Arguments: a hash like
type => 'png', # or jpeg, gif image => $gd_object,
The subroutine determines which kind of image object we have and calls the corresponding *_to_binary method. (At the moment only GD is supported.)
- gd_to_binary
-
Arguments: ($gd_object, $type)
$type can be png, jpeg or gif.
Returns:
data:image/$type;base64,$the_rendered_image_as_base64
SEE ALSO
COPYRIGHT AND LICENSE
Copyright (C) 2006 by tina mueller
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.