#!/usr/pkg/bin/perl # Author : Stefan Schumacher, # PGP : 0xB3FBAE33 # Purpose : create a HTML gallery with thumbnails # Created : Thu Dec 26 02:05:21 CET 2003 # $Header: /home/daten/cvs/net-tex.de/code/album.pl.txt,v 1.3 2006/07/16 22:15:45 stefan Exp $ # Needs : ImageMagick (convert) # released under BSD License, # like Public Domain, closed source, GPL or other # $Id: album.pl.txt,v 1.3 2006/07/16 22:15:45 stefan Exp $ =man NAME album.pl - create a simple HTML album with thumbnails SYNOPSIS album.pl [height] [rows] DESCRIPTION album.pl uses the ImageMagick programm 'convert' to create a thumbnail of specified height and than orders these thumbs in the specified amount of rows =cut # array with all files, counter for number of files my @allfiles = glob "*.[Jj][Pp][Gg]"; my $width = @ARGV[0]; my $rows = @ARGV[1]; my $file = 'index.html'; my $cnt = 0; my $pwd = `pwd`; if($width eq '-v'){ print "album.pl version $Revision: 1.3 $ 20060716 \n(C) Stefan Schumacher http://www.net-tex.de\nreleased under BSD Licence \n";} elsif($width eq '-h' || $width eq ''){ print "album.pl -v : show version album.pl -h : show this help album.pl 120 4 : create an album using 120 pixel high sized thumbs in 4 rows\n"; } else{ #connect filehandle open FILE,">>$file" or die; print FILE ("\n

www.net-tex.de



\n

$pwd

Klicken Sie auf die Bilder um zur Großansicht zu gelangen. Dort befinden sich ggf. auch Kommentare zu den Bildern.
\n\n"); # run through directory for each file for my $file (@allfiles) { my $filenew = (split /.jpg/,$file)[0].'-small.jpg'; my $identified= `identify $file`; my $dimensions = (split / /,$identified)[2]; my $size = (split / /,$identified)[5]; my $identified = `convert -comment 'Stefan Schumacher/net-tex.de' -size $width -resize $width $file $filenew`; my $htmlfile=(split /.jpg/,$filenew)[0].'.html'; # print link to index.html print FILE ("\n"); open HTMLFILE,">$htmlfile" or die "cannot open file for reading: $!" ; print HTMLFILE ("
Index

\n
$file
$dimensions $size

\n\n

www.net-tex.de\n
"); close(HTMLFILE); # break at x rows $cnt++; if($cnt % $rows == 0){ print FILE ("\n"); } }#for print FILE ("\n

$file
$dimensions $size<\/a>
\n
created with album.pl
Alle Rechte verbleiben beim Urheber, jegliche Weiterverbreitung ist untersagt.
Autor: Stefan Schumacher, PGP: 0xB3FBAE33, www.net-tex.de \n\n"); }#else