#!/usr/bin/perl
#
=head1 NAME
phogal.pl
=head1 AUTHOR
Matteo Redaelli
E-MAIL: matteo.redaelli@libero.it
WEB: http://digilander.iol.it/reda
=head1 DESCRIPTION
This is a nice and innovative photo gallery generator: it doesn't
create any thumbnails but it reduce the size of the original pictures
and insert them in several web pages with fortune cookies (provided
by the command "fortune"). Than you can replace them inserting your
personal comments/descriptions of the pictures..
=head1 USAGE
type perl phogal.pl
=head1 REQUIREMENTS
perl interpreter (www.perl.org)
ImageMagick (http://www.imagemagick.org)
forture package
=head1 HISTORY
2002-03-10: first lines of this script
2002-03-11: added "fortune" support: afterward you can replace cookies with
your favourite comment
=head1 LICENSE
This package is free software; you can redistribute it and/or
modify it under the same terms as Perl itself, i.e., under the
terms of the "Artistic License" or the "GNU General Public License".
=head1 DISCLAIMER
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the "GNU General Public License" for more details.
=cut
use Getopt::Std;
use strict;
my $dest_dir = $ARGV[0];
my $label = $dest_dir;
$label =~ s/_/ /g;
my $step = 5;
my @files = <*.jpg *.JPG>;
my $menu;
sub build_menu
{
my $result = "";
for my $c (0 .. int( $#files / $step ) ) {
$c = "" if $c == 0;
$result = $result . "index$c ";
}
return $result;
}
sub openhtmlfile
{
my $c = int(@_[0] / $step) ;
$c = "" if $c == 0;
open STDOUT, ">$dest_dir/index$c.html";
print <
$label
$menu
$label
EOC
}
sub closehtmlfile
{
print <