]> mj.ucw.cz Git - gallery.git/commitdiff
Temporary move to gal/, so that we can import history from mj-web
authorMartin Mares <mj@ucw.cz>
Sun, 8 Feb 2015 20:13:07 +0000 (21:13 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 8 Feb 2015 20:13:07 +0000 (21:13 +0100)
70 files changed:
Gallery.pm [deleted file]
Gallery/Archive.pm [deleted file]
Gallery/Generator.pm [deleted file]
Gallery/Web.pm [deleted file]
Makefile [deleted file]
gal-gen [deleted file]
gal-merge [deleted file]
gal-scan [deleted file]
gal/Gallery.pm [new file with mode: 0644]
gal/Gallery/Archive.pm [new file with mode: 0644]
gal/Gallery/Generator.pm [new file with mode: 0644]
gal/Gallery/Web.pm [new file with mode: 0644]
gal/Makefile [new file with mode: 0644]
gal/gal-gen [new file with mode: 0755]
gal/gal-merge [new file with mode: 0755]
gal/gal-scan [new file with mode: 0755]
gal/nrt-blue/back.png [new file with mode: 0644]
gal/nrt-blue/back.xcf [new file with mode: 0644]
gal/nrt-blue/bot.png [new file with mode: 0644]
gal/nrt-blue/bot.xcf [new file with mode: 0644]
gal/nrt-blue/left.png [new file with mode: 0644]
gal/nrt-blue/left.xcf [new file with mode: 0644]
gal/nrt-blue/next.png [new file with mode: 0644]
gal/nrt-blue/next.xcf [new file with mode: 0644]
gal/nrt-blue/prev.png [new file with mode: 0644]
gal/nrt-blue/prev.xcf [new file with mode: 0644]
gal/nrt-blue/right.png [new file with mode: 0644]
gal/nrt-blue/right.xcf [new file with mode: 0644]
gal/nrt-blue/style.css [new file with mode: 0644]
gal/nrt-blue/theme.conf [new file with mode: 0644]
gal/nrt-blue/theme.pm [new file with mode: 0644]
gal/nrt-blue/top.png [new file with mode: 0644]
gal/nrt-blue/top.xcf [new file with mode: 0644]
gal/nrt/back.png [new file with mode: 0644]
gal/nrt/bot.png [new file with mode: 0644]
gal/nrt/left.png [new file with mode: 0644]
gal/nrt/next.png [new file with mode: 0644]
gal/nrt/prev.png [new file with mode: 0644]
gal/nrt/right.png [new file with mode: 0644]
gal/nrt/style.css [new file with mode: 0644]
gal/nrt/theme.conf [new file with mode: 0644]
gal/nrt/theme.pm [new file with mode: 0644]
gal/nrt/top.png [new file with mode: 0644]
nrt-blue/back.png [deleted file]
nrt-blue/back.xcf [deleted file]
nrt-blue/bot.png [deleted file]
nrt-blue/bot.xcf [deleted file]
nrt-blue/left.png [deleted file]
nrt-blue/left.xcf [deleted file]
nrt-blue/next.png [deleted file]
nrt-blue/next.xcf [deleted file]
nrt-blue/prev.png [deleted file]
nrt-blue/prev.xcf [deleted file]
nrt-blue/right.png [deleted file]
nrt-blue/right.xcf [deleted file]
nrt-blue/style.css [deleted file]
nrt-blue/theme.conf [deleted file]
nrt-blue/theme.pm [deleted file]
nrt-blue/top.png [deleted file]
nrt-blue/top.xcf [deleted file]
nrt/back.png [deleted file]
nrt/bot.png [deleted file]
nrt/left.png [deleted file]
nrt/next.png [deleted file]
nrt/prev.png [deleted file]
nrt/right.png [deleted file]
nrt/style.css [deleted file]
nrt/theme.conf [deleted file]
nrt/theme.pm [deleted file]
nrt/top.png [deleted file]

diff --git a/Gallery.pm b/Gallery.pm
deleted file mode 100644 (file)
index b543b45..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-# Simple Photo Gallery
-# (c) 2003--2005 Martin Mares <mj@ucw.cz>
-
-package Gallery;
-
-use strict;
-use warnings;
-
-BEGIN {
-       # Standard Perl module stuff
-       use Exporter();
-       our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
-       $VERSION = 1.00;
-       @ISA = qw(Exporter);
-       @EXPORT = qw(&SetOptions &Start &img &Finish &RawHTML);
-       %EXPORT_TAGS = ();
-       @EXPORT_OK = qw(%CF);
-}
-
-our %CF;
-our $th;
-
-BEGIN {
-       $CF{"Title"} = "An Unnamed Gallery",
-       $CF{"HeadExtras"} = "",
-       $CF{"TopExtras"} = "",
-       $CF{"BotExtras"} = "",
-       $CF{"ParentURL"} = "../",
-       $CF{"BackURL"} = "",
-       $CF{"FwdURL"} = "",
-       $CF{"ImageSubpages"} = 1,
-       $CF{"AllowArchives"} = 1,
-       $CF{"PhotoUrlPrefix"} = "",
-       $CF{"ThumbUrlPrefix"} = "",
-       $CF{"MetaDataDir"} = ".",
-       $CF{"PhotoDir"} = ".",
-       $CF{"ThumbDir"} = ".",
-}
-
-sub SetOptions(@) {
-       while (my $o = shift @_) {
-               my $v = shift @_;
-               $CF{$o} = $v;
-               if ($o eq "Theme") {
-                       require $CF{"GalDir"} . "/$v/theme.pm";
-                       Gallery::Theme::Init($CF{"GalURL"} . "/$v");
-               }
-       }
-}
-
-sub Start() {
-       if (defined $ENV{"GATEWAY_INTERFACE"}) {
-               require Gallery::Web;
-               $th = new Gallery::Web;
-       } else {
-               if (@ARGV && $ARGV[0] eq "--generate") {
-                       require Gallery::Generator;
-                       $th = new Gallery::Generator;
-               } else {
-                       print STDERR "Usage: $0 [--generate]\n";
-                       exit 1;
-               }
-       }
-       $th->Start();
-}
-
-sub img($$) {
-       $th->img(@_);
-}
-
-sub Finish() {
-       $th->Finish();
-}
-
-sub RawHTML($) {
-       $th->RawHTML($_[0]);
-}
-
-1;
diff --git a/Gallery/Archive.pm b/Gallery/Archive.pm
deleted file mode 100644 (file)
index 6fb3457..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Simple Photo Gallery: Web Archiver
-# (c) 2005 Martin Mares <mj@ucw.cz>
-
-package Gallery::Archive;
-import Gallery qw(%CF);
-
-use IO::Handle;
-
-sub new($$) {
-       my ($cls, $type) = @_;
-       my $x = { 'type' => $type, 'files' => [] };
-       return bless $x;
-}
-
-sub Start($) {
-       my ($this) = @_;
-       my $type = $this->{'type'};
-       my $cts = { "tar" => "application/x-tar", "zip" => "application/zip" };
-       defined $cts->{$type} or die "Unknown archive type $type";
-       print "Content-Type: ", $cts->{$type}, "\n";
-       print "Content-Disposition: inline;filename=gallery.$type\n";
-       print "\n";
-}
-
-sub Finish($) {
-       my ($this) = @_;
-       my $type = $this->{'type'};
-       STDOUT->flush();
-       chdir($CF{"PhotoDir"}) or die;
-       if ($type eq "tar") {
-               system("/home/mj/bin/tar", "cf", "-", @{$this->{'files'}});
-       } elsif ($type eq "zip") {
-               system("zip", "-", @{$this->{'files'}});
-       } else { die; }
-}
-
-sub RawHTML($$) {
-}
-
-sub img($$$) {
-       my ($this, $orig, $annot) = @_;
-       push @{$this->{'files'}}, $orig;
-}
-
-1;
diff --git a/Gallery/Generator.pm b/Gallery/Generator.pm
deleted file mode 100644 (file)
index b3542a1..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-# Simple Photo Gallery: Thumbnail Generator
-# (c) 2003--2004 Martin Mares <mj@ucw.cz>
-
-package Gallery::Generator;
-
-use strict;
-use warnings;
-
-use Image::Magick;
-use IO::Handle;
-
-BEGIN { import Gallery qw(%CF); }
-
-sub new() { return bless {}; }
-
-sub Start($) {
-       print "Generating thumbnails...\n"; STDOUT->autoflush(1);
-       my $notes = $CF{'MetaDataDir'} . "/notes";
-       open NOTES, ">$notes" or die "Unable to write to notes ($notes): $!";
-}
-
-sub Finish($) {
-       close NOTES;
-       print "Done.\n";
-}
-
-sub RawHTML($$) { }
-
-sub img($$$) {
-       my ($this, $orig, $annot) = @_;
-       my ($base, $ext) = ($orig =~ /^(.*)\.([^.]+)$/) or die "Unable to dissect name $orig";
-       print "$base: ";
-       my $p = new Image::Magick;
-       my $e;
-       my $img = $CF{"PhotoDir"} . $orig;
-       $e = $p->Read($img) and die "Error reading $img: $e";
-       my ($wo, $ho) = $p->Get('width', 'height');
-       my ($w, $h) = ($wo, $ho);
-       print "${w}x${h}";
-       $p->Strip;
-       if ($w > $CF{"ThumbW"}) {
-               my $s = $CF{"ThumbW"} / $w;
-               $w = $w * $s;
-               $h = $h * $s;
-       }
-       if ($h > $CF{"ThumbH"}) {
-               my $s = $CF{"ThumbH"} / $h;
-               $w = $w * $s;
-               $h = $h * $s;
-       }
-       $w = int($w);
-       $h = int($h);
-       print " -> ${w}x${h} ";
-       $p->Resize(width=>$w, height=>$h);
-       my $thumb = $CF{"ThumbDir"} . "$base-thumb.jpg";
-       $e = $p->Write($thumb) and die "Unable to write $thumb: $e";
-       print NOTES "$base $w $h $wo $ho\n";
-       print "OK\n";
-}
-
-1;
diff --git a/Gallery/Web.pm b/Gallery/Web.pm
deleted file mode 100644 (file)
index 03b8d7a..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-# Simple Photo Gallery: Web Interface
-# (c) 2003--2005 Martin Mares <mj@ucw.cz>
-
-package Gallery::Web;
-import Gallery qw(%CF);
-
-use UCW::CGI;
-
-my $show_img;
-my $send_archive;
-
-my %args = (
-       'i'     => { 'var' => \$show_img, 'check' => '\d+' },
-       'a'     => { 'var' => \$send_archive }
-);
-
-sub new() {
-       UCW::CGI::parse_args(\%args);
-       if ($send_archive && $CF{'AllowArchives'}) {
-               require Gallery::Archive;
-               return new Gallery::Archive($send_archive);
-       } else {
-               return bless {};
-       }
-}
-
-sub error($) {
-       print "<p style='color:red'>Bad luck, the script is broken. Sorry.\n<p>$_[0]\n";
-       print "</body></html>\n";
-}
-
-our (@images, %widths, %heights, %widths_orig, %heights_orig, %imgno);
-
-sub load_notes() {
-       @images = ("");
-       %widths = ();
-       %heights = ();
-       %imgno = ();
-       my $notes = $CF{'MetaDataDir'} . "/notes";
-       open NOTES, $notes or die "Unable to read notes ($notes): $!";
-       while (<NOTES>) {
-               chomp;
-               my ($n, $w, $h, $wo, $ho) = split /\s+/;
-               push @images, $n;
-               $widths{$n} = $w;
-               $heights{$n} = $h;
-               $widths_orig{$n} = $wo;
-               $heights_orig{$n} = $ho;
-               $imgno{$n} = $#images;
-       }
-       close NOTES;
-}
-
-sub show_links($$$) {
-       my ($prev, $up, $next) = @_;
-       print "<p class=parent>";
-       print "<span class=back style='width: $CF{'BackW'}px; height: $CF{'BackH'}px'>";
-       print "<a href='$prev'><img src='$CF{'BackImg'}' width=$CF{'BackW'} height=$CF{'BackH'} alt='Back'></a>" if $prev ne "";
-       print "</span>\n";
-       print "<span class=fwd style='width: $CF{'FwdW'}px; height: $CF{'FwdH'}px'>";
-       print "<a href='$next'><img src='$CF{'FwdImg'}' width=$CF{'FwdW'} height=$CF{'FwdH'} alt='Forward'></a>" if $next ne "";
-       print "</span>\n";
-       print "<a href='$up'><img src='$CF{'ParentImg'}' width=$CF{'ParentW'} height=$CF{'ParentH'} alt='Up'></a>\n" if $up ne "";
-}
-
-sub Start($) {
-       my $title = UCW::CGI::html_escape($CF{"Title"});
-       print <<EOF ;
-Content-Type: text/html
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html><head>
-$CF{"HeadExtras"}
-<link rel=stylesheet href="$CF{"StyleSheet"}" type="text/css" media=all>
-<title>$title</title>
-</head><body>
-$CF{"TopExtras"}
-EOF
-       $UCW::CGI::error_hook = \&error;
-       load_notes();
-       if ($show_img ne "" && $show_img > 0 && $show_img <= $#images) {
-               show_links(($show_img > 1 ? ("?i=".($show_img-1)) : ""),
-                          "?",
-                          ($show_img < $#images ? ("?i=".($show_img+1)) : ""));
-       } else {
-               show_links($CF{'BackURL'}, $CF{'ParentURL'}, $CF{'FwdURL'});
-               print "<h1>$CF{'Title'}</h1>\n";
-               print "<h2>$CF{'SubTitle'}</h2>\n" if defined $CF{'SubTitle'};
-       }
-}
-
-sub Finish($) {
-       print "$CF{'BotExtras'}\n</body></html>\n";
-}
-
-sub RawHTML($$) {
-       my ($obj, $h) = @_;
-       print $h if $show_img eq "";
-}
-
-sub img($$$) {
-       my ($this, $orig, $annot) = @_;
-       my ($base, $ext) = ($orig =~ /^(.*)\.([^.]+)$/) or die "Unable to dissect name $orig";
-       $annot = UCW::CGI::html_escape($annot);
-       my $id = $imgno{$base} || 0;
-
-       if ($show_img ne "") {
-               if ($id == $show_img) {
-                       print "<h1>$annot</h1>\n" if $annot ne "";
-                       my $img = $CF{'PhotoUrlPrefix'} . $orig;
-                       print "<p class=large><img src='$img' width=$widths_orig{$base} height=$heights_orig{$base} alt='$orig'>\n";
-               }
-               return;
-       }
-
-       my $thumb = $CF{'ThumbUrlPrefix'} . "$base-thumb.jpg";
-       my $w = $widths{$base} || 10;
-       my $h = $heights{$base} || 10;
-       my $side_w = $CF{"ThumbW"} + 2*$CF{"InteriorMargin"};
-       my $side_h = $CF{"ThumbH"} + 2*$CF{"InteriorMargin"};
-       my $box_w = $CF{"LeftW"} + $side_w + $CF{"RightW"};
-       my $box_h = $CF{"TopH"} + $side_h + $CF{"BotH"};
-       print "<div class=thf><div class=thumb>\n";
-       print "<img src='$CF{'TopImg'}' width=$box_w height=$CF{'TopH'} alt='' class=tt>\n";
-       print "<img src='$CF{'LeftImg'}' width=$CF{'LeftW'} height=$side_h alt='' class=tl>\n";
-       my $ol = $CF{'LeftW'} + $CF{'InteriorMargin'} + int(($CF{'ThumbW'} - $w)/2);
-       my $ot = $CF{'TopH'} + $CF{'InteriorMargin'} + int(($CF{'ThumbH'} - $h)/2);
-       my $tit = ($annot ne "") ? " title=\"$annot\"" : "";
-       my $url = ($CF{"ImageSubpages"} ? "?i=$id" : $orig);
-       print "<a href='$url'><img src='$thumb' width=$w height=$h alt='$orig'$tit class=ti style='left: ${ol}px; top: ${ot}px'></a>\n";
-       print "<img src='$CF{'RightImg'}' width=$CF{'RightW'} height=$side_h alt='' class=tr>\n";
-       print "<img src='$CF{'BotImg'}' width=$box_w height=$CF{'BotH'} alt='' class=tb>\n";
-       print "</div>\n";
-#      if ($annot ne "") {
-#              print "<p class=annot>$annot\n";
-#      }
-       print "</div>\n\n";
-}
-
-1;
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 264a0af..0000000
--- a/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-$(eval $(dir-setup))
-
-$(call lib-copy, Gallery.pm)
-$(call lib-copy, $(addprefix Gallery/,Archive.pm Generator.pm Web.pm))
-
-$(call copy, $(addprefix nrt-blue/,back.png bot.png left.png next.png prev.png right.png top.png theme.pm style.css))
diff --git a/gal-gen b/gal-gen
deleted file mode 100755 (executable)
index af63d4c..0000000
--- a/gal-gen
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/perl
-# Generate image gallery
-# (c) 2004--2007 Martin Mares <mj@ucw.cz>
-
-# Syntax of input file:
-# <filename>   <datestamp>     <rotation>      <xform>
-# where <rotation> is either ".", "l", "r" or "u"
-#       <xform> contains:
-#              d       touch output file to <datestamp>
-#              D       include <datestamp> in output file names
-#              n       normalize contrast
-#              s       sharpen
-#              h       equalize histogram
-
-use Image::Magick;
-use IO::Handle;
-
-use strict;
-use warnings;
-
-my $maxw = 1024;
-my $maxh = 768;
-my $recompress = 1;
-
-STDERR->autoflush(1);
-print STDERR "Searching for template file... ";
-
-my $tdir = "";
-my $templ;
-my $maxdepth = 10;
-while ($maxdepth--) {
-       my $t = "${tdir}gallery.cf";
-       if (-f $t) {
-               $templ = $t;
-               last;
-       }
-       $tdir .= "../";
-       last if ! -d $tdir;
-}
-if ($templ) {
-       print STDERR "$templ\n";
-} else {
-       print STDERR "NONE\n";
-}
-
-print "#!/usr/bin/perl\n\n";
-if ($templ) {
-       print "require \"$templ\";\n\n";
-       print "SetOptions(\n";
-} else {
-       print <<EOF
-use lib '/home/mj/WWW/gal';
-use Gallery;
-
-SetOptions(
-       "GalURL" => "/~mj/gal",
-       "GalDir" => "/home/mj/WWW/gal",
-       "Theme" => "nrt",
-EOF
-;
-}
-print <<EOF
-       "Title" => "Untitled"
-);
-Start();
-EOF
-;
-
-#`rm -f [0-9]*.{jpg,png} *.tmp`;  $? && die;
-
-my $idx = 0;
-while (<STDIN>) {
-       chomp;
-       my ($src, $date, $rotate, $xform) = split (/\t+/, $_);
-       $idx++;
-       my $id = sprintf("%03d", $idx);
-       if ($xform =~ /D/) {
-               $id = "$date-$id";
-               $id =~ s/ /-/g;
-       }
-       my $dest;
-       my $is_jpeg = 0;
-       if ($src =~ /\.(jpg|JPG|jpeg)$/) {
-               $dest = "$id.jpg";
-               $is_jpeg = 1;
-       } elsif ($src =~ /\.png$/) {
-               $dest = "$id.png";
-       } else {
-               die "$src: Unknown image type";
-       }
-       my $tmp = "$dest.tmp";
-       print STDERR "$dest: $src ";
-
-       my $p = new Image::Magick;
-       my $e;
-       $e = $p->Read($src) and die "Error reading $tmp: $e";
-       $p->Strip;
-       $p->SetAttribute(quality=>90);
-       my ($w, $h) = $p->Get('width', 'height');
-       print STDERR "-> ${w}x${h} ";
-
-       my ($w0, $h0) = ($rotate eq "l" || $rotate eq "r") ? ($h, $w) : ($w, $h);
-       my ($ww, $hh) = ($w0, $h0);
-       if ($ww > $maxw) {
-               my $s = $maxw / $ww;
-               $ww = $ww * $s;
-               $hh = $hh * $s;
-       }
-       if ($hh > $maxh) {
-               my $s = $maxh / $hh;
-               $ww = $ww * $s;
-               $hh = $hh * $s;
-       }
-       $ww = int($ww);
-       $hh = int($hh);
-
-       if ($recompress ||
-           !$is_jpeg ||
-           $xform ne "" ||
-           $ww != $w0 || $hh != $h0) {
-               my $rot = 0;
-               if ($rotate eq "l") { $rot = 270; }
-               elsif ($rotate eq "r") { $rot = 90; }
-               elsif ($rotate eq "u") { $rot = 180; }
-               if ($xform =~ /s/) {
-                       print STDERR "-> sharpen ";
-                       $p->Sharpen(1);
-               }
-               if ($xform =~ /h/) {
-                       print STDERR "-> equalize ";
-                       $p->Equalize();
-               }
-               if ($xform =~ /n/) {
-                       print STDERR "-> normalize ";
-                       $p->Normalize();
-               }
-               if ($rot) {
-                       print STDERR "-> rotate $rot ";
-                       $p->Rotate(degrees=>$rot);
-                       $rotate = ".";
-               }
-               if ($ww != $w0 || $hh != $h0) {
-                       print STDERR "-> ${ww}x${hh} ";
-                       $p->Resize(width=>$ww, height=>$hh);
-               }
-               $e = $p->Write($tmp) and die "Unable to write $tmp: $e";
-       } else {
-               `cp $src $tmp`;  $? && die;
-       }
-
-       if ($is_jpeg) {
-               my $tran = "-optimize -copy none";
-                  if ($rotate eq ".") { }
-               elsif ($rotate eq "l") { $tran .= " -rotate 270 -trim"; }
-               elsif ($rotate eq "r") { $tran .= " -rotate 90 -trim"; }
-               elsif ($rotate eq "u") { $tran .= " -rotate 180 -trim"; }
-               else { die "Unknown rotation type $rotate"; }
-               print STDERR "-> $tran ";
-               `jpegtran $tran <$tmp >$dest`;  $? && die;
-       } else {
-               rename $tmp, $dest or die;
-       }
-
-       if ($xform =~ /d/) {
-               `touch -d "$date" $dest`; die if $?;
-       }
-
-       unlink $tmp;
-       print STDERR "... OK\n";
-       print "img(\"$dest\", \"\");\t\t# $src (${w0}x${h0})\n";
-}
-
-print "Finish();\n";
-
-`rm -f *.tmp`;  $? && die;
diff --git a/gal-merge b/gal-merge
deleted file mode 100755 (executable)
index 26fc164..0000000
--- a/gal-merge
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/perl
-# Merge photos from multiple sources
-# (c) 2008 Martin Mares <mj@ucw.cz>
-
-use Image::EXIF;
-use Data::Dumper;
-
-use strict;
-use warnings;
-
-my @pics = ();
-if (@ARGV) {
-       @pics = @ARGV;
-} else {
-       while (<STDIN>) {
-               chomp;
-               /^#/ && next;
-               /^$/ && next;
-               push @pics, $_;
-       }
-}
-
-my %seen = ();
-foreach my $f (@pics) {
-       my $e = new Image::EXIF($f);
-       my $i = $e->get_all_info();
-       if ($e->error) { print STDERR "EXIF error on $f: ", $e->error, "\n"; }
-       else {
-               #print STDERR Dumper($i), "\n";
-               my $o = $i->{'image'}->{'Image Orientation'} || "Top, Left-Hand";
-               if ($o eq "Top, Left-Hand") { $o = "."; }
-               elsif ($o eq "Right-Hand, Top") { $o = "r"; }
-               elsif ($o eq "Left-Hand, Bottom") { $o = "l"; }
-               elsif ($o eq "Bottom, Right-Hand") { $o = "d"; }
-               else {
-                       print STDERR "Unrecognized orientation: $o\n";
-                       $o = ".";
-               }
-               my $d = $i->{'image'}->{'Image Created'};
-               if (defined($d)) {
-                       $d =~ s/^(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})/$1$2$3-$4$5$6/ or die "Date parse error: $d";
-               } else {
-                       print STDERR "Unrecognized data, skipping: $f\n";
-                       next;
-               }
-               my $fn = $d;
-               if ($f =~ m{^\.\./orig/(\w+)/}) {
-                       $fn = "$fn-$1";
-               }
-               if (defined $seen{$fn}) {
-                       my $c = ++$seen{$fn};
-                       $fn = "$fn-$c";
-               } else {
-                       $seen{$fn} = 1;
-               }
-               print "ln -s '$f' '$fn.jpg'\n";
-       }
-}
diff --git a/gal-scan b/gal-scan
deleted file mode 100755 (executable)
index db41a0b..0000000
--- a/gal-scan
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/perl
-# Scan images in a list or gqview collection and prepare them for gal-gen
-# (c) 2004--2007 Martin Mares <mj@ucw.cz>
-
-use Image::EXIF;
-use Data::Dumper;
-
-use strict;
-use warnings;
-
-my @pics = ();
-if (@ARGV) {
-       @pics = @ARGV;
-} else {
-       while (<STDIN>) {
-               chomp;
-               /^#/ && next;
-               /^$/ && next;
-               if (/^"(.*)"$/) {
-                       push @pics, $1;
-               } else {
-                       die "Parse error: $_";
-               }
-       }
-}
-
-foreach my $f (@pics) {
-       my $e = new Image::EXIF($f);
-       my $i = $e->get_all_info();
-       if ($e->error) { print STDERR "EXIF error on $f: ", $e->error, "\n"; }
-       else {
-               #print STDERR Dumper($i), "\n";
-               my $o = $i->{'image'}->{'Image Orientation'} || "Top, Left-Hand";
-               if ($o eq "Top, Left-Hand") { $o = "."; }
-               elsif ($o eq "Right-Hand, Top") { $o = "r"; }
-               elsif ($o eq "Left-Hand, Bottom") { $o = "l"; }
-               elsif ($o eq "Bottom, Right-Hand") { $o = "d"; }
-               else {
-                       print STDERR "Unrecognized orientation: $o\n";
-                       $o = ".";
-               }
-               my $d = $i->{'image'}->{'Image Created'} || "?";
-               if ($d ne "?") {
-                       $d =~ s/^(\d{4}):(\d{2}):(\d{2}) (\d{2}:\d{2}:\d{2})/$1-$2-$3 $4/ or die "Date parse error: $d";
-               }
-               print "$f\t$d\t$o\tn\n";
-       }
-}
diff --git a/gal/Gallery.pm b/gal/Gallery.pm
new file mode 100644 (file)
index 0000000..b543b45
--- /dev/null
@@ -0,0 +1,79 @@
+# Simple Photo Gallery
+# (c) 2003--2005 Martin Mares <mj@ucw.cz>
+
+package Gallery;
+
+use strict;
+use warnings;
+
+BEGIN {
+       # Standard Perl module stuff
+       use Exporter();
+       our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+       $VERSION = 1.00;
+       @ISA = qw(Exporter);
+       @EXPORT = qw(&SetOptions &Start &img &Finish &RawHTML);
+       %EXPORT_TAGS = ();
+       @EXPORT_OK = qw(%CF);
+}
+
+our %CF;
+our $th;
+
+BEGIN {
+       $CF{"Title"} = "An Unnamed Gallery",
+       $CF{"HeadExtras"} = "",
+       $CF{"TopExtras"} = "",
+       $CF{"BotExtras"} = "",
+       $CF{"ParentURL"} = "../",
+       $CF{"BackURL"} = "",
+       $CF{"FwdURL"} = "",
+       $CF{"ImageSubpages"} = 1,
+       $CF{"AllowArchives"} = 1,
+       $CF{"PhotoUrlPrefix"} = "",
+       $CF{"ThumbUrlPrefix"} = "",
+       $CF{"MetaDataDir"} = ".",
+       $CF{"PhotoDir"} = ".",
+       $CF{"ThumbDir"} = ".",
+}
+
+sub SetOptions(@) {
+       while (my $o = shift @_) {
+               my $v = shift @_;
+               $CF{$o} = $v;
+               if ($o eq "Theme") {
+                       require $CF{"GalDir"} . "/$v/theme.pm";
+                       Gallery::Theme::Init($CF{"GalURL"} . "/$v");
+               }
+       }
+}
+
+sub Start() {
+       if (defined $ENV{"GATEWAY_INTERFACE"}) {
+               require Gallery::Web;
+               $th = new Gallery::Web;
+       } else {
+               if (@ARGV && $ARGV[0] eq "--generate") {
+                       require Gallery::Generator;
+                       $th = new Gallery::Generator;
+               } else {
+                       print STDERR "Usage: $0 [--generate]\n";
+                       exit 1;
+               }
+       }
+       $th->Start();
+}
+
+sub img($$) {
+       $th->img(@_);
+}
+
+sub Finish() {
+       $th->Finish();
+}
+
+sub RawHTML($) {
+       $th->RawHTML($_[0]);
+}
+
+1;
diff --git a/gal/Gallery/Archive.pm b/gal/Gallery/Archive.pm
new file mode 100644 (file)
index 0000000..6fb3457
--- /dev/null
@@ -0,0 +1,45 @@
+# Simple Photo Gallery: Web Archiver
+# (c) 2005 Martin Mares <mj@ucw.cz>
+
+package Gallery::Archive;
+import Gallery qw(%CF);
+
+use IO::Handle;
+
+sub new($$) {
+       my ($cls, $type) = @_;
+       my $x = { 'type' => $type, 'files' => [] };
+       return bless $x;
+}
+
+sub Start($) {
+       my ($this) = @_;
+       my $type = $this->{'type'};
+       my $cts = { "tar" => "application/x-tar", "zip" => "application/zip" };
+       defined $cts->{$type} or die "Unknown archive type $type";
+       print "Content-Type: ", $cts->{$type}, "\n";
+       print "Content-Disposition: inline;filename=gallery.$type\n";
+       print "\n";
+}
+
+sub Finish($) {
+       my ($this) = @_;
+       my $type = $this->{'type'};
+       STDOUT->flush();
+       chdir($CF{"PhotoDir"}) or die;
+       if ($type eq "tar") {
+               system("/home/mj/bin/tar", "cf", "-", @{$this->{'files'}});
+       } elsif ($type eq "zip") {
+               system("zip", "-", @{$this->{'files'}});
+       } else { die; }
+}
+
+sub RawHTML($$) {
+}
+
+sub img($$$) {
+       my ($this, $orig, $annot) = @_;
+       push @{$this->{'files'}}, $orig;
+}
+
+1;
diff --git a/gal/Gallery/Generator.pm b/gal/Gallery/Generator.pm
new file mode 100644 (file)
index 0000000..b3542a1
--- /dev/null
@@ -0,0 +1,61 @@
+# Simple Photo Gallery: Thumbnail Generator
+# (c) 2003--2004 Martin Mares <mj@ucw.cz>
+
+package Gallery::Generator;
+
+use strict;
+use warnings;
+
+use Image::Magick;
+use IO::Handle;
+
+BEGIN { import Gallery qw(%CF); }
+
+sub new() { return bless {}; }
+
+sub Start($) {
+       print "Generating thumbnails...\n"; STDOUT->autoflush(1);
+       my $notes = $CF{'MetaDataDir'} . "/notes";
+       open NOTES, ">$notes" or die "Unable to write to notes ($notes): $!";
+}
+
+sub Finish($) {
+       close NOTES;
+       print "Done.\n";
+}
+
+sub RawHTML($$) { }
+
+sub img($$$) {
+       my ($this, $orig, $annot) = @_;
+       my ($base, $ext) = ($orig =~ /^(.*)\.([^.]+)$/) or die "Unable to dissect name $orig";
+       print "$base: ";
+       my $p = new Image::Magick;
+       my $e;
+       my $img = $CF{"PhotoDir"} . $orig;
+       $e = $p->Read($img) and die "Error reading $img: $e";
+       my ($wo, $ho) = $p->Get('width', 'height');
+       my ($w, $h) = ($wo, $ho);
+       print "${w}x${h}";
+       $p->Strip;
+       if ($w > $CF{"ThumbW"}) {
+               my $s = $CF{"ThumbW"} / $w;
+               $w = $w * $s;
+               $h = $h * $s;
+       }
+       if ($h > $CF{"ThumbH"}) {
+               my $s = $CF{"ThumbH"} / $h;
+               $w = $w * $s;
+               $h = $h * $s;
+       }
+       $w = int($w);
+       $h = int($h);
+       print " -> ${w}x${h} ";
+       $p->Resize(width=>$w, height=>$h);
+       my $thumb = $CF{"ThumbDir"} . "$base-thumb.jpg";
+       $e = $p->Write($thumb) and die "Unable to write $thumb: $e";
+       print NOTES "$base $w $h $wo $ho\n";
+       print "OK\n";
+}
+
+1;
diff --git a/gal/Gallery/Web.pm b/gal/Gallery/Web.pm
new file mode 100644 (file)
index 0000000..03b8d7a
--- /dev/null
@@ -0,0 +1,140 @@
+# Simple Photo Gallery: Web Interface
+# (c) 2003--2005 Martin Mares <mj@ucw.cz>
+
+package Gallery::Web;
+import Gallery qw(%CF);
+
+use UCW::CGI;
+
+my $show_img;
+my $send_archive;
+
+my %args = (
+       'i'     => { 'var' => \$show_img, 'check' => '\d+' },
+       'a'     => { 'var' => \$send_archive }
+);
+
+sub new() {
+       UCW::CGI::parse_args(\%args);
+       if ($send_archive && $CF{'AllowArchives'}) {
+               require Gallery::Archive;
+               return new Gallery::Archive($send_archive);
+       } else {
+               return bless {};
+       }
+}
+
+sub error($) {
+       print "<p style='color:red'>Bad luck, the script is broken. Sorry.\n<p>$_[0]\n";
+       print "</body></html>\n";
+}
+
+our (@images, %widths, %heights, %widths_orig, %heights_orig, %imgno);
+
+sub load_notes() {
+       @images = ("");
+       %widths = ();
+       %heights = ();
+       %imgno = ();
+       my $notes = $CF{'MetaDataDir'} . "/notes";
+       open NOTES, $notes or die "Unable to read notes ($notes): $!";
+       while (<NOTES>) {
+               chomp;
+               my ($n, $w, $h, $wo, $ho) = split /\s+/;
+               push @images, $n;
+               $widths{$n} = $w;
+               $heights{$n} = $h;
+               $widths_orig{$n} = $wo;
+               $heights_orig{$n} = $ho;
+               $imgno{$n} = $#images;
+       }
+       close NOTES;
+}
+
+sub show_links($$$) {
+       my ($prev, $up, $next) = @_;
+       print "<p class=parent>";
+       print "<span class=back style='width: $CF{'BackW'}px; height: $CF{'BackH'}px'>";
+       print "<a href='$prev'><img src='$CF{'BackImg'}' width=$CF{'BackW'} height=$CF{'BackH'} alt='Back'></a>" if $prev ne "";
+       print "</span>\n";
+       print "<span class=fwd style='width: $CF{'FwdW'}px; height: $CF{'FwdH'}px'>";
+       print "<a href='$next'><img src='$CF{'FwdImg'}' width=$CF{'FwdW'} height=$CF{'FwdH'} alt='Forward'></a>" if $next ne "";
+       print "</span>\n";
+       print "<a href='$up'><img src='$CF{'ParentImg'}' width=$CF{'ParentW'} height=$CF{'ParentH'} alt='Up'></a>\n" if $up ne "";
+}
+
+sub Start($) {
+       my $title = UCW::CGI::html_escape($CF{"Title"});
+       print <<EOF ;
+Content-Type: text/html
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html><head>
+$CF{"HeadExtras"}
+<link rel=stylesheet href="$CF{"StyleSheet"}" type="text/css" media=all>
+<title>$title</title>
+</head><body>
+$CF{"TopExtras"}
+EOF
+       $UCW::CGI::error_hook = \&error;
+       load_notes();
+       if ($show_img ne "" && $show_img > 0 && $show_img <= $#images) {
+               show_links(($show_img > 1 ? ("?i=".($show_img-1)) : ""),
+                          "?",
+                          ($show_img < $#images ? ("?i=".($show_img+1)) : ""));
+       } else {
+               show_links($CF{'BackURL'}, $CF{'ParentURL'}, $CF{'FwdURL'});
+               print "<h1>$CF{'Title'}</h1>\n";
+               print "<h2>$CF{'SubTitle'}</h2>\n" if defined $CF{'SubTitle'};
+       }
+}
+
+sub Finish($) {
+       print "$CF{'BotExtras'}\n</body></html>\n";
+}
+
+sub RawHTML($$) {
+       my ($obj, $h) = @_;
+       print $h if $show_img eq "";
+}
+
+sub img($$$) {
+       my ($this, $orig, $annot) = @_;
+       my ($base, $ext) = ($orig =~ /^(.*)\.([^.]+)$/) or die "Unable to dissect name $orig";
+       $annot = UCW::CGI::html_escape($annot);
+       my $id = $imgno{$base} || 0;
+
+       if ($show_img ne "") {
+               if ($id == $show_img) {
+                       print "<h1>$annot</h1>\n" if $annot ne "";
+                       my $img = $CF{'PhotoUrlPrefix'} . $orig;
+                       print "<p class=large><img src='$img' width=$widths_orig{$base} height=$heights_orig{$base} alt='$orig'>\n";
+               }
+               return;
+       }
+
+       my $thumb = $CF{'ThumbUrlPrefix'} . "$base-thumb.jpg";
+       my $w = $widths{$base} || 10;
+       my $h = $heights{$base} || 10;
+       my $side_w = $CF{"ThumbW"} + 2*$CF{"InteriorMargin"};
+       my $side_h = $CF{"ThumbH"} + 2*$CF{"InteriorMargin"};
+       my $box_w = $CF{"LeftW"} + $side_w + $CF{"RightW"};
+       my $box_h = $CF{"TopH"} + $side_h + $CF{"BotH"};
+       print "<div class=thf><div class=thumb>\n";
+       print "<img src='$CF{'TopImg'}' width=$box_w height=$CF{'TopH'} alt='' class=tt>\n";
+       print "<img src='$CF{'LeftImg'}' width=$CF{'LeftW'} height=$side_h alt='' class=tl>\n";
+       my $ol = $CF{'LeftW'} + $CF{'InteriorMargin'} + int(($CF{'ThumbW'} - $w)/2);
+       my $ot = $CF{'TopH'} + $CF{'InteriorMargin'} + int(($CF{'ThumbH'} - $h)/2);
+       my $tit = ($annot ne "") ? " title=\"$annot\"" : "";
+       my $url = ($CF{"ImageSubpages"} ? "?i=$id" : $orig);
+       print "<a href='$url'><img src='$thumb' width=$w height=$h alt='$orig'$tit class=ti style='left: ${ol}px; top: ${ot}px'></a>\n";
+       print "<img src='$CF{'RightImg'}' width=$CF{'RightW'} height=$side_h alt='' class=tr>\n";
+       print "<img src='$CF{'BotImg'}' width=$box_w height=$CF{'BotH'} alt='' class=tb>\n";
+       print "</div>\n";
+#      if ($annot ne "") {
+#              print "<p class=annot>$annot\n";
+#      }
+       print "</div>\n\n";
+}
+
+1;
diff --git a/gal/Makefile b/gal/Makefile
new file mode 100644 (file)
index 0000000..264a0af
--- /dev/null
@@ -0,0 +1,6 @@
+$(eval $(dir-setup))
+
+$(call lib-copy, Gallery.pm)
+$(call lib-copy, $(addprefix Gallery/,Archive.pm Generator.pm Web.pm))
+
+$(call copy, $(addprefix nrt-blue/,back.png bot.png left.png next.png prev.png right.png top.png theme.pm style.css))
diff --git a/gal/gal-gen b/gal/gal-gen
new file mode 100755 (executable)
index 0000000..af63d4c
--- /dev/null
@@ -0,0 +1,175 @@
+#!/usr/bin/perl
+# Generate image gallery
+# (c) 2004--2007 Martin Mares <mj@ucw.cz>
+
+# Syntax of input file:
+# <filename>   <datestamp>     <rotation>      <xform>
+# where <rotation> is either ".", "l", "r" or "u"
+#       <xform> contains:
+#              d       touch output file to <datestamp>
+#              D       include <datestamp> in output file names
+#              n       normalize contrast
+#              s       sharpen
+#              h       equalize histogram
+
+use Image::Magick;
+use IO::Handle;
+
+use strict;
+use warnings;
+
+my $maxw = 1024;
+my $maxh = 768;
+my $recompress = 1;
+
+STDERR->autoflush(1);
+print STDERR "Searching for template file... ";
+
+my $tdir = "";
+my $templ;
+my $maxdepth = 10;
+while ($maxdepth--) {
+       my $t = "${tdir}gallery.cf";
+       if (-f $t) {
+               $templ = $t;
+               last;
+       }
+       $tdir .= "../";
+       last if ! -d $tdir;
+}
+if ($templ) {
+       print STDERR "$templ\n";
+} else {
+       print STDERR "NONE\n";
+}
+
+print "#!/usr/bin/perl\n\n";
+if ($templ) {
+       print "require \"$templ\";\n\n";
+       print "SetOptions(\n";
+} else {
+       print <<EOF
+use lib '/home/mj/WWW/gal';
+use Gallery;
+
+SetOptions(
+       "GalURL" => "/~mj/gal",
+       "GalDir" => "/home/mj/WWW/gal",
+       "Theme" => "nrt",
+EOF
+;
+}
+print <<EOF
+       "Title" => "Untitled"
+);
+Start();
+EOF
+;
+
+#`rm -f [0-9]*.{jpg,png} *.tmp`;  $? && die;
+
+my $idx = 0;
+while (<STDIN>) {
+       chomp;
+       my ($src, $date, $rotate, $xform) = split (/\t+/, $_);
+       $idx++;
+       my $id = sprintf("%03d", $idx);
+       if ($xform =~ /D/) {
+               $id = "$date-$id";
+               $id =~ s/ /-/g;
+       }
+       my $dest;
+       my $is_jpeg = 0;
+       if ($src =~ /\.(jpg|JPG|jpeg)$/) {
+               $dest = "$id.jpg";
+               $is_jpeg = 1;
+       } elsif ($src =~ /\.png$/) {
+               $dest = "$id.png";
+       } else {
+               die "$src: Unknown image type";
+       }
+       my $tmp = "$dest.tmp";
+       print STDERR "$dest: $src ";
+
+       my $p = new Image::Magick;
+       my $e;
+       $e = $p->Read($src) and die "Error reading $tmp: $e";
+       $p->Strip;
+       $p->SetAttribute(quality=>90);
+       my ($w, $h) = $p->Get('width', 'height');
+       print STDERR "-> ${w}x${h} ";
+
+       my ($w0, $h0) = ($rotate eq "l" || $rotate eq "r") ? ($h, $w) : ($w, $h);
+       my ($ww, $hh) = ($w0, $h0);
+       if ($ww > $maxw) {
+               my $s = $maxw / $ww;
+               $ww = $ww * $s;
+               $hh = $hh * $s;
+       }
+       if ($hh > $maxh) {
+               my $s = $maxh / $hh;
+               $ww = $ww * $s;
+               $hh = $hh * $s;
+       }
+       $ww = int($ww);
+       $hh = int($hh);
+
+       if ($recompress ||
+           !$is_jpeg ||
+           $xform ne "" ||
+           $ww != $w0 || $hh != $h0) {
+               my $rot = 0;
+               if ($rotate eq "l") { $rot = 270; }
+               elsif ($rotate eq "r") { $rot = 90; }
+               elsif ($rotate eq "u") { $rot = 180; }
+               if ($xform =~ /s/) {
+                       print STDERR "-> sharpen ";
+                       $p->Sharpen(1);
+               }
+               if ($xform =~ /h/) {
+                       print STDERR "-> equalize ";
+                       $p->Equalize();
+               }
+               if ($xform =~ /n/) {
+                       print STDERR "-> normalize ";
+                       $p->Normalize();
+               }
+               if ($rot) {
+                       print STDERR "-> rotate $rot ";
+                       $p->Rotate(degrees=>$rot);
+                       $rotate = ".";
+               }
+               if ($ww != $w0 || $hh != $h0) {
+                       print STDERR "-> ${ww}x${hh} ";
+                       $p->Resize(width=>$ww, height=>$hh);
+               }
+               $e = $p->Write($tmp) and die "Unable to write $tmp: $e";
+       } else {
+               `cp $src $tmp`;  $? && die;
+       }
+
+       if ($is_jpeg) {
+               my $tran = "-optimize -copy none";
+                  if ($rotate eq ".") { }
+               elsif ($rotate eq "l") { $tran .= " -rotate 270 -trim"; }
+               elsif ($rotate eq "r") { $tran .= " -rotate 90 -trim"; }
+               elsif ($rotate eq "u") { $tran .= " -rotate 180 -trim"; }
+               else { die "Unknown rotation type $rotate"; }
+               print STDERR "-> $tran ";
+               `jpegtran $tran <$tmp >$dest`;  $? && die;
+       } else {
+               rename $tmp, $dest or die;
+       }
+
+       if ($xform =~ /d/) {
+               `touch -d "$date" $dest`; die if $?;
+       }
+
+       unlink $tmp;
+       print STDERR "... OK\n";
+       print "img(\"$dest\", \"\");\t\t# $src (${w0}x${h0})\n";
+}
+
+print "Finish();\n";
+
+`rm -f *.tmp`;  $? && die;
diff --git a/gal/gal-merge b/gal/gal-merge
new file mode 100755 (executable)
index 0000000..26fc164
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/perl
+# Merge photos from multiple sources
+# (c) 2008 Martin Mares <mj@ucw.cz>
+
+use Image::EXIF;
+use Data::Dumper;
+
+use strict;
+use warnings;
+
+my @pics = ();
+if (@ARGV) {
+       @pics = @ARGV;
+} else {
+       while (<STDIN>) {
+               chomp;
+               /^#/ && next;
+               /^$/ && next;
+               push @pics, $_;
+       }
+}
+
+my %seen = ();
+foreach my $f (@pics) {
+       my $e = new Image::EXIF($f);
+       my $i = $e->get_all_info();
+       if ($e->error) { print STDERR "EXIF error on $f: ", $e->error, "\n"; }
+       else {
+               #print STDERR Dumper($i), "\n";
+               my $o = $i->{'image'}->{'Image Orientation'} || "Top, Left-Hand";
+               if ($o eq "Top, Left-Hand") { $o = "."; }
+               elsif ($o eq "Right-Hand, Top") { $o = "r"; }
+               elsif ($o eq "Left-Hand, Bottom") { $o = "l"; }
+               elsif ($o eq "Bottom, Right-Hand") { $o = "d"; }
+               else {
+                       print STDERR "Unrecognized orientation: $o\n";
+                       $o = ".";
+               }
+               my $d = $i->{'image'}->{'Image Created'};
+               if (defined($d)) {
+                       $d =~ s/^(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})/$1$2$3-$4$5$6/ or die "Date parse error: $d";
+               } else {
+                       print STDERR "Unrecognized data, skipping: $f\n";
+                       next;
+               }
+               my $fn = $d;
+               if ($f =~ m{^\.\./orig/(\w+)/}) {
+                       $fn = "$fn-$1";
+               }
+               if (defined $seen{$fn}) {
+                       my $c = ++$seen{$fn};
+                       $fn = "$fn-$c";
+               } else {
+                       $seen{$fn} = 1;
+               }
+               print "ln -s '$f' '$fn.jpg'\n";
+       }
+}
diff --git a/gal/gal-scan b/gal/gal-scan
new file mode 100755 (executable)
index 0000000..db41a0b
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+# Scan images in a list or gqview collection and prepare them for gal-gen
+# (c) 2004--2007 Martin Mares <mj@ucw.cz>
+
+use Image::EXIF;
+use Data::Dumper;
+
+use strict;
+use warnings;
+
+my @pics = ();
+if (@ARGV) {
+       @pics = @ARGV;
+} else {
+       while (<STDIN>) {
+               chomp;
+               /^#/ && next;
+               /^$/ && next;
+               if (/^"(.*)"$/) {
+                       push @pics, $1;
+               } else {
+                       die "Parse error: $_";
+               }
+       }
+}
+
+foreach my $f (@pics) {
+       my $e = new Image::EXIF($f);
+       my $i = $e->get_all_info();
+       if ($e->error) { print STDERR "EXIF error on $f: ", $e->error, "\n"; }
+       else {
+               #print STDERR Dumper($i), "\n";
+               my $o = $i->{'image'}->{'Image Orientation'} || "Top, Left-Hand";
+               if ($o eq "Top, Left-Hand") { $o = "."; }
+               elsif ($o eq "Right-Hand, Top") { $o = "r"; }
+               elsif ($o eq "Left-Hand, Bottom") { $o = "l"; }
+               elsif ($o eq "Bottom, Right-Hand") { $o = "d"; }
+               else {
+                       print STDERR "Unrecognized orientation: $o\n";
+                       $o = ".";
+               }
+               my $d = $i->{'image'}->{'Image Created'} || "?";
+               if ($d ne "?") {
+                       $d =~ s/^(\d{4}):(\d{2}):(\d{2}) (\d{2}:\d{2}:\d{2})/$1-$2-$3 $4/ or die "Date parse error: $d";
+               }
+               print "$f\t$d\t$o\tn\n";
+       }
+}
diff --git a/gal/nrt-blue/back.png b/gal/nrt-blue/back.png
new file mode 100644 (file)
index 0000000..501909c
Binary files /dev/null and b/gal/nrt-blue/back.png differ
diff --git a/gal/nrt-blue/back.xcf b/gal/nrt-blue/back.xcf
new file mode 100644 (file)
index 0000000..5d8848d
Binary files /dev/null and b/gal/nrt-blue/back.xcf differ
diff --git a/gal/nrt-blue/bot.png b/gal/nrt-blue/bot.png
new file mode 100644 (file)
index 0000000..86bb5f2
Binary files /dev/null and b/gal/nrt-blue/bot.png differ
diff --git a/gal/nrt-blue/bot.xcf b/gal/nrt-blue/bot.xcf
new file mode 100644 (file)
index 0000000..a3dbedc
Binary files /dev/null and b/gal/nrt-blue/bot.xcf differ
diff --git a/gal/nrt-blue/left.png b/gal/nrt-blue/left.png
new file mode 100644 (file)
index 0000000..a9852c7
Binary files /dev/null and b/gal/nrt-blue/left.png differ
diff --git a/gal/nrt-blue/left.xcf b/gal/nrt-blue/left.xcf
new file mode 100644 (file)
index 0000000..76912ed
Binary files /dev/null and b/gal/nrt-blue/left.xcf differ
diff --git a/gal/nrt-blue/next.png b/gal/nrt-blue/next.png
new file mode 100644 (file)
index 0000000..bdd1011
Binary files /dev/null and b/gal/nrt-blue/next.png differ
diff --git a/gal/nrt-blue/next.xcf b/gal/nrt-blue/next.xcf
new file mode 100644 (file)
index 0000000..ad06333
Binary files /dev/null and b/gal/nrt-blue/next.xcf differ
diff --git a/gal/nrt-blue/prev.png b/gal/nrt-blue/prev.png
new file mode 100644 (file)
index 0000000..68b2514
Binary files /dev/null and b/gal/nrt-blue/prev.png differ
diff --git a/gal/nrt-blue/prev.xcf b/gal/nrt-blue/prev.xcf
new file mode 100644 (file)
index 0000000..dbf35d5
Binary files /dev/null and b/gal/nrt-blue/prev.xcf differ
diff --git a/gal/nrt-blue/right.png b/gal/nrt-blue/right.png
new file mode 100644 (file)
index 0000000..7af66ba
Binary files /dev/null and b/gal/nrt-blue/right.png differ
diff --git a/gal/nrt-blue/right.xcf b/gal/nrt-blue/right.xcf
new file mode 100644 (file)
index 0000000..0668d05
Binary files /dev/null and b/gal/nrt-blue/right.xcf differ
diff --git a/gal/nrt-blue/style.css b/gal/nrt-blue/style.css
new file mode 100644 (file)
index 0000000..ce8d2de
--- /dev/null
@@ -0,0 +1,18 @@
+.thf    { margin: 0 0 0 0; padding: 0 0 0 0; float: left; border: none; }
+.thumb  { position: relative; width: 154px; height: 134px; background-color: black; }
+.tt     { position: absolute; top: 0; left: 0; }
+.tl     { position: absolute; top: 14px; left: 0; }
+.ti     { position: absolute; }
+.tr     { position: absolute; top: 14px; right: 0; }
+.tb     { position: absolute; bottom: 0; right: 0; }
+.annot  { width: 154px; text-align: center; }
+IMG     { border: none; }
+H1      { text-align: center; }
+H2      { text-align: center; margin-bottom: 3ex; }
+P      { clear: both; }
+H2     { clear: both; }
+.parent        { text-align: center; }
+.large { text-align: center; }
+.back  { float: left; }
+.fwd   { float: right; }
+A[href]:hover { background-color: #11001d; }
diff --git a/gal/nrt-blue/theme.conf b/gal/nrt-blue/theme.conf
new file mode 100644 (file)
index 0000000..4242eba
--- /dev/null
@@ -0,0 +1,40 @@
+
+PicturesPerRow: 5
+BGColor: #ffffff
+TextColor: #000000
+CommentColor: #000000
+FilmBGColor: #322207
+LinkColor: #000000
+ALinkColor: gold
+VLinkColor: #000000
+LinkSize: 1
+
+#                   linksize               | top
+#                       |                  v
+#     ------------------|---------------- ---
+#     |                 |               |  |
+#     ------------------v---------------- ---
+#     |   | ______________________  |   |  ^
+#     |   | |   ^                 | |   |  |
+#     |   | |   | height          | |   |
+#     |   | |   |                 | |   |
+#  l  |   | |   |                 | |   | right
+# --->|---| |<--|----width------->| |---|<-----
+#     |   | |   |                 | |   |
+#     |   | |   |                 | |   |
+#     |   | |   |                 | |   |
+#     |   | |   v                 | |   |
+#     |   | |---------------------| |   |  |
+#     |   |                         |   |  v
+#     ----------------------------------- ---
+#     |                                 |  |
+#     ----------------------------------- ---
+#                                          ^
+#                                          | bottom
+#
+# total = left + linksize + width + linksize + right
+
+# Decorations: top bottom left right
+Decorations: 14 18 14 18
+ThumbWidth: 120
+ThumbHeight: 100
diff --git a/gal/nrt-blue/theme.pm b/gal/nrt-blue/theme.pm
new file mode 100644 (file)
index 0000000..780ade0
--- /dev/null
@@ -0,0 +1,37 @@
+# NRT Theme for MJ's Photo Gallery
+# (c) 2003--2004 Martin Mares <mj@ucw.cz>; GPL'ed
+# Theme images taken from the cthumb package (c) Carlos Puchol
+
+package Gallery::Theme;
+
+use strict;
+use warnings;
+
+sub Init($) {
+       my ($u) = @_;
+       Gallery::SetOptions(
+               "StyleSheet" => "$u/style.css",
+               "ThumbW" => 114,
+               "ThumbH" => 94,
+               "TopImg" => "$u/top.png",
+               "TopH" => 14,
+               "BotImg" => "$u/bot.png",
+               "BotH" => 18,
+               "LeftImg" => "$u/left.png",
+               "LeftW" => 14,
+               "RightImg" => "$u/right.png",
+               "RightW" => 18,
+               "InteriorMargin" => 4,
+               "ParentImg" => "$u/back.png",
+               "ParentH" => 48,
+               "ParentW" => 48,
+               "BackImg" => "$u/prev.png",
+               "BackH" => 48,
+               "BackW" => 48,
+               "FwdImg" => "$u/next.png",
+               "FwdH" => 48,
+               "FwdW" => 48
+       );
+}
+
+1;
diff --git a/gal/nrt-blue/top.png b/gal/nrt-blue/top.png
new file mode 100644 (file)
index 0000000..db5a677
Binary files /dev/null and b/gal/nrt-blue/top.png differ
diff --git a/gal/nrt-blue/top.xcf b/gal/nrt-blue/top.xcf
new file mode 100644 (file)
index 0000000..8298369
Binary files /dev/null and b/gal/nrt-blue/top.xcf differ
diff --git a/gal/nrt/back.png b/gal/nrt/back.png
new file mode 100644 (file)
index 0000000..c0c4cee
Binary files /dev/null and b/gal/nrt/back.png differ
diff --git a/gal/nrt/bot.png b/gal/nrt/bot.png
new file mode 100644 (file)
index 0000000..08c6683
Binary files /dev/null and b/gal/nrt/bot.png differ
diff --git a/gal/nrt/left.png b/gal/nrt/left.png
new file mode 100644 (file)
index 0000000..3bd3aed
Binary files /dev/null and b/gal/nrt/left.png differ
diff --git a/gal/nrt/next.png b/gal/nrt/next.png
new file mode 100644 (file)
index 0000000..72a4e39
Binary files /dev/null and b/gal/nrt/next.png differ
diff --git a/gal/nrt/prev.png b/gal/nrt/prev.png
new file mode 100644 (file)
index 0000000..71e11cd
Binary files /dev/null and b/gal/nrt/prev.png differ
diff --git a/gal/nrt/right.png b/gal/nrt/right.png
new file mode 100644 (file)
index 0000000..3e655dc
Binary files /dev/null and b/gal/nrt/right.png differ
diff --git a/gal/nrt/style.css b/gal/nrt/style.css
new file mode 100644 (file)
index 0000000..b67b092
--- /dev/null
@@ -0,0 +1,17 @@
+.thf    { margin: 0 0 0 0; padding: 0 0 0 0; float: left; border: none; }
+.thumb  { position: relative; width: 154px; height: 134px; background-color: black; }
+.tt     { position: absolute; top: 0; left: 0; }
+.tl     { position: absolute; top: 14px; left: 0; }
+.ti     { position: absolute; }
+.tr     { position: absolute; top: 14px; right: 0; }
+.tb     { position: absolute; bottom: 0; right: 0; }
+.annot  { width: 154px; text-align: center; }
+IMG     { border: none; }
+H1      { text-align: center; }
+H2      { text-align: center; }
+P      { clear: both; }
+H2     { clear: both; }
+.parent        { text-align: center; }
+.large { text-align: center; }
+.back  { float: left; }
+.fwd   { float: right; }
diff --git a/gal/nrt/theme.conf b/gal/nrt/theme.conf
new file mode 100644 (file)
index 0000000..4242eba
--- /dev/null
@@ -0,0 +1,40 @@
+
+PicturesPerRow: 5
+BGColor: #ffffff
+TextColor: #000000
+CommentColor: #000000
+FilmBGColor: #322207
+LinkColor: #000000
+ALinkColor: gold
+VLinkColor: #000000
+LinkSize: 1
+
+#                   linksize               | top
+#                       |                  v
+#     ------------------|---------------- ---
+#     |                 |               |  |
+#     ------------------v---------------- ---
+#     |   | ______________________  |   |  ^
+#     |   | |   ^                 | |   |  |
+#     |   | |   | height          | |   |
+#     |   | |   |                 | |   |
+#  l  |   | |   |                 | |   | right
+# --->|---| |<--|----width------->| |---|<-----
+#     |   | |   |                 | |   |
+#     |   | |   |                 | |   |
+#     |   | |   |                 | |   |
+#     |   | |   v                 | |   |
+#     |   | |---------------------| |   |  |
+#     |   |                         |   |  v
+#     ----------------------------------- ---
+#     |                                 |  |
+#     ----------------------------------- ---
+#                                          ^
+#                                          | bottom
+#
+# total = left + linksize + width + linksize + right
+
+# Decorations: top bottom left right
+Decorations: 14 18 14 18
+ThumbWidth: 120
+ThumbHeight: 100
diff --git a/gal/nrt/theme.pm b/gal/nrt/theme.pm
new file mode 100644 (file)
index 0000000..780ade0
--- /dev/null
@@ -0,0 +1,37 @@
+# NRT Theme for MJ's Photo Gallery
+# (c) 2003--2004 Martin Mares <mj@ucw.cz>; GPL'ed
+# Theme images taken from the cthumb package (c) Carlos Puchol
+
+package Gallery::Theme;
+
+use strict;
+use warnings;
+
+sub Init($) {
+       my ($u) = @_;
+       Gallery::SetOptions(
+               "StyleSheet" => "$u/style.css",
+               "ThumbW" => 114,
+               "ThumbH" => 94,
+               "TopImg" => "$u/top.png",
+               "TopH" => 14,
+               "BotImg" => "$u/bot.png",
+               "BotH" => 18,
+               "LeftImg" => "$u/left.png",
+               "LeftW" => 14,
+               "RightImg" => "$u/right.png",
+               "RightW" => 18,
+               "InteriorMargin" => 4,
+               "ParentImg" => "$u/back.png",
+               "ParentH" => 48,
+               "ParentW" => 48,
+               "BackImg" => "$u/prev.png",
+               "BackH" => 48,
+               "BackW" => 48,
+               "FwdImg" => "$u/next.png",
+               "FwdH" => 48,
+               "FwdW" => 48
+       );
+}
+
+1;
diff --git a/gal/nrt/top.png b/gal/nrt/top.png
new file mode 100644 (file)
index 0000000..d8d5866
Binary files /dev/null and b/gal/nrt/top.png differ
diff --git a/nrt-blue/back.png b/nrt-blue/back.png
deleted file mode 100644 (file)
index 501909c..0000000
Binary files a/nrt-blue/back.png and /dev/null differ
diff --git a/nrt-blue/back.xcf b/nrt-blue/back.xcf
deleted file mode 100644 (file)
index 5d8848d..0000000
Binary files a/nrt-blue/back.xcf and /dev/null differ
diff --git a/nrt-blue/bot.png b/nrt-blue/bot.png
deleted file mode 100644 (file)
index 86bb5f2..0000000
Binary files a/nrt-blue/bot.png and /dev/null differ
diff --git a/nrt-blue/bot.xcf b/nrt-blue/bot.xcf
deleted file mode 100644 (file)
index a3dbedc..0000000
Binary files a/nrt-blue/bot.xcf and /dev/null differ
diff --git a/nrt-blue/left.png b/nrt-blue/left.png
deleted file mode 100644 (file)
index a9852c7..0000000
Binary files a/nrt-blue/left.png and /dev/null differ
diff --git a/nrt-blue/left.xcf b/nrt-blue/left.xcf
deleted file mode 100644 (file)
index 76912ed..0000000
Binary files a/nrt-blue/left.xcf and /dev/null differ
diff --git a/nrt-blue/next.png b/nrt-blue/next.png
deleted file mode 100644 (file)
index bdd1011..0000000
Binary files a/nrt-blue/next.png and /dev/null differ
diff --git a/nrt-blue/next.xcf b/nrt-blue/next.xcf
deleted file mode 100644 (file)
index ad06333..0000000
Binary files a/nrt-blue/next.xcf and /dev/null differ
diff --git a/nrt-blue/prev.png b/nrt-blue/prev.png
deleted file mode 100644 (file)
index 68b2514..0000000
Binary files a/nrt-blue/prev.png and /dev/null differ
diff --git a/nrt-blue/prev.xcf b/nrt-blue/prev.xcf
deleted file mode 100644 (file)
index dbf35d5..0000000
Binary files a/nrt-blue/prev.xcf and /dev/null differ
diff --git a/nrt-blue/right.png b/nrt-blue/right.png
deleted file mode 100644 (file)
index 7af66ba..0000000
Binary files a/nrt-blue/right.png and /dev/null differ
diff --git a/nrt-blue/right.xcf b/nrt-blue/right.xcf
deleted file mode 100644 (file)
index 0668d05..0000000
Binary files a/nrt-blue/right.xcf and /dev/null differ
diff --git a/nrt-blue/style.css b/nrt-blue/style.css
deleted file mode 100644 (file)
index ce8d2de..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-.thf    { margin: 0 0 0 0; padding: 0 0 0 0; float: left; border: none; }
-.thumb  { position: relative; width: 154px; height: 134px; background-color: black; }
-.tt     { position: absolute; top: 0; left: 0; }
-.tl     { position: absolute; top: 14px; left: 0; }
-.ti     { position: absolute; }
-.tr     { position: absolute; top: 14px; right: 0; }
-.tb     { position: absolute; bottom: 0; right: 0; }
-.annot  { width: 154px; text-align: center; }
-IMG     { border: none; }
-H1      { text-align: center; }
-H2      { text-align: center; margin-bottom: 3ex; }
-P      { clear: both; }
-H2     { clear: both; }
-.parent        { text-align: center; }
-.large { text-align: center; }
-.back  { float: left; }
-.fwd   { float: right; }
-A[href]:hover { background-color: #11001d; }
diff --git a/nrt-blue/theme.conf b/nrt-blue/theme.conf
deleted file mode 100644 (file)
index 4242eba..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-
-PicturesPerRow: 5
-BGColor: #ffffff
-TextColor: #000000
-CommentColor: #000000
-FilmBGColor: #322207
-LinkColor: #000000
-ALinkColor: gold
-VLinkColor: #000000
-LinkSize: 1
-
-#                   linksize               | top
-#                       |                  v
-#     ------------------|---------------- ---
-#     |                 |               |  |
-#     ------------------v---------------- ---
-#     |   | ______________________  |   |  ^
-#     |   | |   ^                 | |   |  |
-#     |   | |   | height          | |   |
-#     |   | |   |                 | |   |
-#  l  |   | |   |                 | |   | right
-# --->|---| |<--|----width------->| |---|<-----
-#     |   | |   |                 | |   |
-#     |   | |   |                 | |   |
-#     |   | |   |                 | |   |
-#     |   | |   v                 | |   |
-#     |   | |---------------------| |   |  |
-#     |   |                         |   |  v
-#     ----------------------------------- ---
-#     |                                 |  |
-#     ----------------------------------- ---
-#                                          ^
-#                                          | bottom
-#
-# total = left + linksize + width + linksize + right
-
-# Decorations: top bottom left right
-Decorations: 14 18 14 18
-ThumbWidth: 120
-ThumbHeight: 100
diff --git a/nrt-blue/theme.pm b/nrt-blue/theme.pm
deleted file mode 100644 (file)
index 780ade0..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# NRT Theme for MJ's Photo Gallery
-# (c) 2003--2004 Martin Mares <mj@ucw.cz>; GPL'ed
-# Theme images taken from the cthumb package (c) Carlos Puchol
-
-package Gallery::Theme;
-
-use strict;
-use warnings;
-
-sub Init($) {
-       my ($u) = @_;
-       Gallery::SetOptions(
-               "StyleSheet" => "$u/style.css",
-               "ThumbW" => 114,
-               "ThumbH" => 94,
-               "TopImg" => "$u/top.png",
-               "TopH" => 14,
-               "BotImg" => "$u/bot.png",
-               "BotH" => 18,
-               "LeftImg" => "$u/left.png",
-               "LeftW" => 14,
-               "RightImg" => "$u/right.png",
-               "RightW" => 18,
-               "InteriorMargin" => 4,
-               "ParentImg" => "$u/back.png",
-               "ParentH" => 48,
-               "ParentW" => 48,
-               "BackImg" => "$u/prev.png",
-               "BackH" => 48,
-               "BackW" => 48,
-               "FwdImg" => "$u/next.png",
-               "FwdH" => 48,
-               "FwdW" => 48
-       );
-}
-
-1;
diff --git a/nrt-blue/top.png b/nrt-blue/top.png
deleted file mode 100644 (file)
index db5a677..0000000
Binary files a/nrt-blue/top.png and /dev/null differ
diff --git a/nrt-blue/top.xcf b/nrt-blue/top.xcf
deleted file mode 100644 (file)
index 8298369..0000000
Binary files a/nrt-blue/top.xcf and /dev/null differ
diff --git a/nrt/back.png b/nrt/back.png
deleted file mode 100644 (file)
index c0c4cee..0000000
Binary files a/nrt/back.png and /dev/null differ
diff --git a/nrt/bot.png b/nrt/bot.png
deleted file mode 100644 (file)
index 08c6683..0000000
Binary files a/nrt/bot.png and /dev/null differ
diff --git a/nrt/left.png b/nrt/left.png
deleted file mode 100644 (file)
index 3bd3aed..0000000
Binary files a/nrt/left.png and /dev/null differ
diff --git a/nrt/next.png b/nrt/next.png
deleted file mode 100644 (file)
index 72a4e39..0000000
Binary files a/nrt/next.png and /dev/null differ
diff --git a/nrt/prev.png b/nrt/prev.png
deleted file mode 100644 (file)
index 71e11cd..0000000
Binary files a/nrt/prev.png and /dev/null differ
diff --git a/nrt/right.png b/nrt/right.png
deleted file mode 100644 (file)
index 3e655dc..0000000
Binary files a/nrt/right.png and /dev/null differ
diff --git a/nrt/style.css b/nrt/style.css
deleted file mode 100644 (file)
index b67b092..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-.thf    { margin: 0 0 0 0; padding: 0 0 0 0; float: left; border: none; }
-.thumb  { position: relative; width: 154px; height: 134px; background-color: black; }
-.tt     { position: absolute; top: 0; left: 0; }
-.tl     { position: absolute; top: 14px; left: 0; }
-.ti     { position: absolute; }
-.tr     { position: absolute; top: 14px; right: 0; }
-.tb     { position: absolute; bottom: 0; right: 0; }
-.annot  { width: 154px; text-align: center; }
-IMG     { border: none; }
-H1      { text-align: center; }
-H2      { text-align: center; }
-P      { clear: both; }
-H2     { clear: both; }
-.parent        { text-align: center; }
-.large { text-align: center; }
-.back  { float: left; }
-.fwd   { float: right; }
diff --git a/nrt/theme.conf b/nrt/theme.conf
deleted file mode 100644 (file)
index 4242eba..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-
-PicturesPerRow: 5
-BGColor: #ffffff
-TextColor: #000000
-CommentColor: #000000
-FilmBGColor: #322207
-LinkColor: #000000
-ALinkColor: gold
-VLinkColor: #000000
-LinkSize: 1
-
-#                   linksize               | top
-#                       |                  v
-#     ------------------|---------------- ---
-#     |                 |               |  |
-#     ------------------v---------------- ---
-#     |   | ______________________  |   |  ^
-#     |   | |   ^                 | |   |  |
-#     |   | |   | height          | |   |
-#     |   | |   |                 | |   |
-#  l  |   | |   |                 | |   | right
-# --->|---| |<--|----width------->| |---|<-----
-#     |   | |   |                 | |   |
-#     |   | |   |                 | |   |
-#     |   | |   |                 | |   |
-#     |   | |   v                 | |   |
-#     |   | |---------------------| |   |  |
-#     |   |                         |   |  v
-#     ----------------------------------- ---
-#     |                                 |  |
-#     ----------------------------------- ---
-#                                          ^
-#                                          | bottom
-#
-# total = left + linksize + width + linksize + right
-
-# Decorations: top bottom left right
-Decorations: 14 18 14 18
-ThumbWidth: 120
-ThumbHeight: 100
diff --git a/nrt/theme.pm b/nrt/theme.pm
deleted file mode 100644 (file)
index 780ade0..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# NRT Theme for MJ's Photo Gallery
-# (c) 2003--2004 Martin Mares <mj@ucw.cz>; GPL'ed
-# Theme images taken from the cthumb package (c) Carlos Puchol
-
-package Gallery::Theme;
-
-use strict;
-use warnings;
-
-sub Init($) {
-       my ($u) = @_;
-       Gallery::SetOptions(
-               "StyleSheet" => "$u/style.css",
-               "ThumbW" => 114,
-               "ThumbH" => 94,
-               "TopImg" => "$u/top.png",
-               "TopH" => 14,
-               "BotImg" => "$u/bot.png",
-               "BotH" => 18,
-               "LeftImg" => "$u/left.png",
-               "LeftW" => 14,
-               "RightImg" => "$u/right.png",
-               "RightW" => 18,
-               "InteriorMargin" => 4,
-               "ParentImg" => "$u/back.png",
-               "ParentH" => 48,
-               "ParentW" => 48,
-               "BackImg" => "$u/prev.png",
-               "BackH" => 48,
-               "BackW" => 48,
-               "FwdImg" => "$u/next.png",
-               "FwdH" => 48,
-               "FwdW" => 48
-       );
-}
-
-1;
diff --git a/nrt/top.png b/nrt/top.png
deleted file mode 100644 (file)
index d8d5866..0000000
Binary files a/nrt/top.png and /dev/null differ