App-Gallery
view release on metacpan or search on metacpan
lib/App/Gallery.pm view on Meta::CPAN
images => [map { scalar fileparse $_ } @images]
);
my $index = catfile $args{out}, 'index.html';
write_file $index, $tmpl->output;
}
$default_template = <<'EOF';
<!DOCTYPE html>
<title><tmpl_var title></title>
<meta charset="utf-8">
<style>
.imgwrap {
display: inline-block;
margin: 6px 3px;
vertical-align: center;
text-align: center;
}
</style>
<link rel="stylesheet" href="style.css">
t/App-Gallery.t view on Meta::CPAN
my $dir = tempdir ('app-gallery.XXXX', TMPDIR => 1, CLEANUP => 1);
my $dir1 = catdir $dir, 'test1';
my $dir2 = catdir $dir, 'test2';
App::Gallery->run({out => $dir1, title => 'Some title', width => 200, height => 200}, @imgs);
my $html = read_file catfile $dir1, 'index.html';
is $html, <<'EOF', 'index.html as expected';
<!DOCTYPE html>
<title>Some title</title>
<meta charset="utf-8">
<style>
.imgwrap {
display: inline-block;
margin: 6px 3px;
vertical-align: center;
text-align: center;
}
</style>
<link rel="stylesheet" href="style.css">
t/App-Gallery.t view on Meta::CPAN
test_img_size (50, 200, catfile $dir1, 'thumb', '100x400.png');
test_img_size (200, 50, catfile $dir1, 'thumb', '800x200.png');
App::Gallery->run({out => $dir2, tmpl => catfile 't', 'example-tmpl'}, @imgs);
$html = read_file catfile $dir2, 'index.html';
is $html, <<'EOF', 'index.html as expected';
<!DOCTYPE html>
<title>Gallery</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<div>
<div><a href='full/100x400.png'><img src='thumb/100x400.png'></a></div>
<div><a href='full/800x200.png'><img src='thumb/800x200.png'></a></div>
</div>
EOF
test_img_size (100, 400, catfile $dir2, 'thumb', '100x400.png');
test_img_size (600, 150, catfile $dir2, 'thumb', '800x200.png');
t/example-tmpl view on Meta::CPAN
<!DOCTYPE html>
<title><tmpl_var title></title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<div>
<tmpl_loop images><div><a href='full/<tmpl_var _>'><img src='thumb/<tmpl_var _>'></a></div>
</tmpl_loop></div>
( run in 0.249 second using v1.01-cache-2.11-cpan-4d50c553e7e )