% % unless ($request->{images_staff_printed}) { # print that stuff only once per request ... % $request->{images_staff_printed} = 1; % % % } %
Вставить картинку ]
% <%args> $object => undef $name => undef $attrs => undef $meta => undef <%init> return unless ref $object; # needed images ... my %attrs = map {$_ => 1} ref $attrs eq 'ARRAY' ? @{$attrs} : ($attrs); my @struct = grep {$attrs{$_->{attr}}} $object->structure; my @images; # get an images ... for my $prop (@struct) { if ($prop->{type} eq 'images') { my @i = $object->get_pics($prop->{attr}); $_->{main_attr} = $prop->{attr} for @i; push @images, @i; } elsif ($prop->{type} eq 'image') { my $i = $object->get_pic($prop->{attr}); next unless ref $i; $i->{main_attr} = $prop->{attr}; push @images, $i; } } return unless @images; # max dimensions of image (for calculating popup size) ... my ($w, $h); for my $img (@images) { $w = $img->mw if $img->mw > $w; $h = $img->mh if $img->mh > $h; } # properties ... my $pr = { w => $w, h => $h, img_padd => 10, title_h => 20, nav_h => 30, butt_h => 20, main_border_color => '#777', nav_border_color => '#aaa', butt_border_color => '#999', };