#!/usr/bin/perl -w ############################################################################## # set up thumbnail links # Author: Chris Rouch # Date: 2000-2003 # # Copyright (c) Chris Rouch 2000-2003 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program 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. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # or see http://www.gnu.org/licenses/gpl.txt ############################################################################## use strict; use Getopt::Long; use Image::Size; # constants use constant IMGDIR => "./images"; use constant IMGURL => "./images"; use constant BORDER => 2; use constant THUMBSIZE=>100; use constant DEFCOLS=>3; use constant PREFIX=>'s_'; # general global variables my ($PROG,$USAGE,$OPTIONS); # command line variables my $cols=DEFCOLS; my $verbose; # make some noise my $inline; # make an inline image my $imgdir=IMGDIR; # where to find the images my $imgurl=IMGURL; # (relative) url for the images my $prefix=PREFIX; # thumbnail prefix use vars qw ($thumb $img $str $linkstr $fthumb $fimg); use vars qw ($iwidth $iheight $twidth $theight $tabwidth @strs $count); # command line switch my %opts= ( "c|cols=i" => \$cols, "i|inline" => \$inline, "d|dir=s" => \$imgdir, "u|url=s" => \$imgurl, "p|prefix=s" => \$prefix, "v|verbose" => \$verbose, ); ($PROG=$0) =~ s#.*/##; SetUsage(\%opts,\$OPTIONS); $USAGE="Usage: $PROG $OPTIONS"; die "$USAGE\n" unless GetOptions(%opts); # program begins here $count=0; print "
|
$str
|
TEXT HOOK
]; } else { # not inline if ($linkstr) { print qq[