#!/usr/bin/perl use strict; use warnings; use blib; use HTML::Template::Compiled 0.73; use HTML::Template::Compiled::Plugin::InlineImage; use Fcntl qw(:seek); # ---------- Image -------------- my $data; { open my $fh, "examples/punk_smiley.gif" or die $!; local $/; $data = <$fh>; } # ---------- HTC ---------------- my ($template, $script); #$HTML::Template::Compiled::Plugin::InlineImage::SIZE_WARNING = 0; { local $/; $template = ; seek DATA, 0, SEEK_SET; $script = ; } my $htc = HTML::Template::Compiled->new( scalarref => \$template, debug => 0, plugin => [qw(HTML::Template::Compiled::Plugin::InlineImage)], ); $htc->param( raw => $data, template => $template, code => $script, ); print $htc->output; __DATA__ HTML::Template::Compiled::Plugin::InlineImage example

Images


GIF: alt="test">

The Template:

<%= template escape=html %>

The whole script:

<%= code escape=html %>