#!/usr/bin/perl -w
use strict;
use List::Util qw(max);
use Getopt::Long;
#########################################
#
# picsite.pl
#
# Create WWW gallery from JPEG files.
#
# This script takes all JPEG files in the
# current directory, creates scaled down
# thumbnail copies and creates a HTML page
# for each image as well as an overview
# page with all the thumbnails.
#
# You'll need Perl, jhead (exif reader), the ImageMagick suite and an
# external 'ls' command from e.g. Unix or Cygwin.
#
# http://www.perl.com/
# http://www.imagemagick.org/
# http://www.debian.org/
# http://www.cygwin.com/
# http://www.sentex.net/~mwandel/jhead/
#
# (c) 2000-2005 Ralf Hüls Kamera: $exif{'Camera model'} Brennweite: $exif{'Focal length'} Blende: $exif{'Aperture'} Zeit: $exif{'Exposure time'} Blitz: $exif{'Flash used'}
\n";
print F "\n";
print F "
\n";
if ($disclaimer) {
print F "Sollten sich auf diesen Seiten Abbildungen von Personen befinden, die mit
der Veröffentlichung nicht einverstanden sind, so bitte ich um Mitteilung. Ich werde die Bilder
dann umgehend entfernen.\n";
$i=1;
$mogline="";
for ($k=0;$k < 16;$k++)
{
$n=($j-1)*16+$k;
unless (defined $files[$n]) {
next;
}
$base=$files[$n];
$mogline .= " thumb$base";
$mogline =~ s/.JPG/.jpg/;
print "$n $base";
undef %exif;
@exif=split /\n/,`jhead $base`;
foreach (@exif) {
$tag=$_;
$value=$_;
$tag =~ s/^([^:]*):.*$/$1/;
$tag =~ s/ *$//;
$value =~ s/^[^:]*:(.*)$/$1/;
$value =~ s/^ *//;
$value =~ s/ *$//;
$exif{$tag}=$value;
# print "#$tag#$value|\n";
}
if ($image) {
`jhead -autorot $base`;
$maxres=max(split /x/,$exif{'Resolution'});
$maxres =~ s/ *$//;
$maxres =~ s/^ *//;
unless (-f "$path/$pre$maxres.png") {
$percent=$maxres/$largest*100;
print "\nNOTE: making $path/$pre$maxres.png ($percent%)\n";
`cp "$path/$pre$largest.png" "$path/$pre$maxres.png"`;
`mogrify -geometry $percent% "$path/$pre$maxres.png"`;
}
`composite -compose over "$path/$pre$maxres.png" $base $base`;
$percent=$default/$maxres*100;
print "MaxRes: $maxres => $percent%";
if ($percent < 100) {
`mogrify -quality 75% -geometry $percent% -unsharp 2x1+1+0 "$base"`;
}
}
print "\n";
$base=~ s/.jpg$//;
$base=~ s/.JPG$//;
if ($n < (scalar @files)-1)
{
$nbase=$files[$n+1];
$nbase=~ s/\.jpg$/\.html/;
$nbase=~ s/\.JPG$/\.html/;
}
else
{
$nbase= "index.html";
}
if ($n > 0)
{
$lbase=$files[$n-1];
$lbase=~ s/\.jpg$/\.html/;
$lbase=~ s/\.JPG$/\.html/;
}
else
{
$lbase= "index.html";
}
`cp "$files[$n]" "thumb$base.jpg"`;
`mogrify -geometry 20% "thumb$base.jpg"`;
print F " \n";
print F "\n";
print F " \n";
if ($i==4)
{
print F "
\n";
print F "\n";
$i=0;
}
$i++;
open G,">$base.html";
print G "\n";
print G "\n";
print G "\n";
print G " \n";
print F "
\n";
print G "\n";
print G "
\n";
print G "
\n";
print G "
\n";
print G "Index $j
\n";
print H "![]()