#!/usr/bin/perl # yathumb.pl - Simple web thumbnail page creator # Project homepage: http://www.landrop.com/yathumb.html # # 0.0.6: added html page for each image containing prev/index/next links (July 2003) # 0.0.5: added command line options: # 0.0.4: added ability to use either .html or .php # 0.0.3: added footer option (internal version) (Only works with php) # 0.0.2: added in check for ImageMagick version (internal version) # 0.0.1: 1st release, April 20 2002 # 18 May 2002: Rename Project to yathumb.pl # 16 Apr 2002: Begin working on gthumb.pl, using genethumb.sh as a guide # # # The genethumb.sh project can be found at http://sam.zoy.org/projects/unix/genethumb.html # there is also a freshmeat.net page for genethumb.sh # # 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 # use Cwd; use File::Basename; use Getopt::Long qw(:config no_auto_abbrev); $version="0.0.6"; $THFILE="index.html"; # if your site has php, and want a nicer looking page, change to index.php $THDIR="."; # put thumbnails in current dir by default $THEXT="jpg"; # change this to png or whatever you want $THWIDTH=96; # thumbnail width $THHEIGHT=72; # thumbnail height $THCOLS=4; # change to set table width -- 0 for no tables $WIDTH=800; # image width $HEIGHT=600; # image height $HEADER="http://www.example.com/head.inc"; # your sites header file. (only active with index.php) $imgHEADER=$HEADER; $FOOTER=' '; # your sites footer file (if you want a footer file add it here, only works with php) $imgFOOTER=$FOOTER; $loop=0; # Version check imagemagick ($temp)=split(' ', `identify -help | cut -d ' ' -f 3 -s`); ($temp)=split('\.', $temp); if ( $temp == 4 ) { $RESPOS=1; $SIZPOS=3; } else { $RESPOS=2; $SIZPOS=5; } #process the command line my $html = ''; my $cols = ''; my $help = ''; GetOptions ( 'html' => \$html, 'cols|c:i' => \$cols, 'width=i' => \$WIDTH, 'height=i' => \$HEIGT, 'help' => \$help); if($cols > 0) { $THCOLS=$cols; } if($html == 1){ $THFILE="index.html"; } # check if index exists, if so, back it up if ( -e "$THFILE" ) { system("mv", "$THFILE", "$THFILE.bak"); } # Check if the thumb nail dir exists, if not create it if ( !-e $THDIR ) { system("mkdir", $THDIR); } open (FILE, ">$THFILE") || die "Could not write to $file\n"; if ( $THFILE ne 'index.html' ) { print FILE "<\?php\ \$cwd=exec(\"pwd\")\;\ \$title=basename(\$cwd)\;\ include(\"$HEADER\")\;\ \?>"; } else { $temp = basename(getcwd); print FILE "\
| \
$TruncName $geom[$SIZPOS] $geom[$RESPOS]\ | \n";
if ($column == $THCOLS ) {
print FILE "