/usr/share/perl5/Excel/Template/Element/Image.pm is in libexcel-template-perl 0.34-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | package Excel::Template::Element::Image;
use strict;
BEGIN {
use vars qw(@ISA);
@ISA = qw(Excel::Template::Element);
use Excel::Template::Element;
}
sub render {
my $self = shift;
my ($context) = @_;
my ($row, $col, $path, $offset, $scale) = map {
$context->get($self, $_)
} qw( ROW COL PATH OFFSET SCALE );
my @offsets = (0,0);
if ( $offset =~ /^\s*([\d.]+)\s*,\s*([\d.]+)/ ) {
@offsets = ($1,$2);
}
my @scales = (0,0);
if ( $scale =~ /^\s*([\d.]+)\s*,\s*([\d.]+)/ ) {
@scales = ($1,$2);
}
$context->active_worksheet->insert_bitmap(
$row, $col, $path, @offsets, @scales,
);
return 1;
}
sub deltas {
return {
COL => +1,
};
}
1;
__END__
=head1 NAME
Excel::Template::Element::Image - Excel::Template::Element::Image
=head1 PURPOSE
To insert an image into the worksheet
=head1 NODE NAME
IMAGE
=head1 INHERITANCE
L<ELEMENT|Excel::Template::Element>
=head1 EFFECTS
This will consume one column in the current row.
=head1 DEPENDENCIES
None
=head1 USAGE
<image path="/Some/Full/Path" />
<image path="/Some/Full/Path" offset="2,5" />
<image path="/Some/Full/Path" scale="2,0.4" />
<image path="/Some/Full/Path" offset="4,0" scale="0,2" />
Please see L<Spreadsheet::WriteExcel/> for more information about the offset and scaling options as well as any other restrictions that might be in place. This node does B<NOT> perform any sort of validation upon your parameters. You are assumed to know what you are doing.
Note that the offset and scaling values are "X,Y". You I<must> provide both values, even if the Y value is 0. If you provide a 0 value for either scaling option, L<Spreadsheet::WriteExcel/> will default that to 1.
=head1 AUTHOR
Rob Kinyon (rob.kinyon@gmail.com)
=head1 SEE ALSO
Nothing
=cut
|