App-Gallery
view release on metacpan or search on metacpan
Changes
gallery.pl
lib/App/Gallery.pm
Makefile.PL
MANIFEST
README
t/100x400.png
t/800x200.png
t/App-Gallery.t
t/example-tmpl
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
SIGNATURE Public-key signature (added by MakeMaker)
Hash: SHA512
SHA1 424a6e50bf0d12246f649d5a56fac6ae8c43d88a Changes
SHA1 5b5c1bedbf70e7a4e1278c7d664a2dfabd335f3f MANIFEST
SHA1 1dc688fd3f08768731a94b8f47186f7b2482e635 META.json
SHA1 aca9f2b4652c659d0ea243683cd831aa25ba5a9e META.yml
SHA1 099377d266187e880eadce5d8f254f6e941501d8 Makefile.PL
SHA1 274d2cf85c5fb26e8a228d02617073400bacdcd9 README
SHA1 07c8a462f4878bbc9b12b5089e1255184ec1d819 gallery.pl
SHA1 763cd72f5993f19b0e06691883c31b0401d53bae lib/App/Gallery.pm
SHA1 226a50c6aaec161d97ea64365bc8ae217ba7fed4 t/100x400.png
SHA1 531e3174dc16538ba5be566c310f95450af6d673 t/800x200.png
SHA1 7d391f026facfc7224b8582c53cf5f4db01155a0 t/App-Gallery.t
SHA1 b05414fd4ab8f8e62cb16e0ed0ab57dcb39514da t/example-tmpl
-----BEGIN PGP SIGNATURE-----
iQJEBAEBCgAuFiEErVNvYICb0H7KK/jxygQ1vl7Bs2IFAlmPDqkQHG1hcml1c0Bp
ZXZhbC5ybwAKCRDKBDW+XsGzYmByEACLzSpg59kbOARleeAvi2bEoQHQuVW2d7LH
7frMo0EbrgJr/LeppQzNq2xhEc95zEhIIFFHXBBt1wSl1OqmWrPxMrCIyMMEkaTA
IJyZH09aRLd5nxW1u/XnZjoIzHdI0GFUn0FtdMJsyQBDDM9I2pBFa289e/T76B0C
q82FMJgN04Xxu5ulpvc8e28C3VTM+BM2OdP+8Ng5qA/B1lz63JUFspLlaT6+ZSZT
6RBOjuh7r82EtDwxBQIVH7M1AVcYeAzR8tlHv0M2tRAVnil+2DYCcqfWeex9Np/m
t/App-Gallery.t view on Meta::CPAN
sub test_img_size {
my ($width, $height, $file) = @_;
my $image = Image::Magick->new;
$image->Read($file);
my ($actual_width, $actual_height) = $image->Get(qw/width height/);
is $width, $actual_width, 'image width';
is $height, $actual_height, 'image height';
}
my @imgs = <t/*.png>;
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>
t/App-Gallery.t view on Meta::CPAN
display: inline-block;
margin: 6px 3px;
vertical-align: center;
text-align: center;
}
</style>
<link rel="stylesheet" href="style.css">
<h1>Some title</h1>
<div>
<div class=imgwrap><a href='full/100x400.png'><img src='thumb/100x400.png'></a></div>
<div class=imgwrap><a href='full/800x200.png'><img src='thumb/800x200.png'></a></div>
</div>
EOF
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');
( run in 1.814 second using v1.01-cache-2.11-cpan-df04353d9ac )