]> mj.ucw.cz Git - gallery.git/commitdiff
Initial import
authorMartin Mares <mj@ucw.cz>
Sun, 16 Sep 2001 22:00:00 +0000 (00:00 +0200)
committerMartin Mares <mj@ucw.cz>
Sun, 8 Feb 2015 20:10:19 +0000 (21:10 +0100)
35 files changed:
Gallery.pm [new file with mode: 0644]
Gallery/Archive.pm [new file with mode: 0644]
Gallery/Generator.pm [new file with mode: 0644]
Gallery/Web.pm [new file with mode: 0644]
Makefile [new file with mode: 0644]
gal-gen [new file with mode: 0755]
gal-merge [new file with mode: 0755]
gal-scan [new file with mode: 0755]
nrt-blue/back.png [new file with mode: 0644]
nrt-blue/back.xcf [new file with mode: 0644]
nrt-blue/bot.png [new file with mode: 0644]
nrt-blue/bot.xcf [new file with mode: 0644]
nrt-blue/left.png [new file with mode: 0644]
nrt-blue/left.xcf [new file with mode: 0644]
nrt-blue/next.png [new file with mode: 0644]
nrt-blue/next.xcf [new file with mode: 0644]
nrt-blue/prev.png [new file with mode: 0644]
nrt-blue/prev.xcf [new file with mode: 0644]
nrt-blue/right.png [new file with mode: 0644]
nrt-blue/right.xcf [new file with mode: 0644]
nrt-blue/style.css [new file with mode: 0644]
nrt-blue/theme.conf [new file with mode: 0644]
nrt-blue/theme.pm [new file with mode: 0644]
nrt-blue/top.png [new file with mode: 0644]
nrt-blue/top.xcf [new file with mode: 0644]
nrt/back.png [new file with mode: 0644]
nrt/bot.png [new file with mode: 0644]
nrt/left.png [new file with mode: 0644]
nrt/next.png [new file with mode: 0644]
nrt/prev.png [new file with mode: 0644]
nrt/right.png [new file with mode: 0644]
nrt/style.css [new file with mode: 0644]
nrt/theme.conf [new file with mode: 0644]
nrt/theme.pm [new file with mode: 0644]
nrt/top.png [new file with mode: 0644]

diff --git a/Gallery.pm b/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/Gallery/Archive.pm b/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/Gallery/Generator.pm b/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/Gallery/Web.pm b/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/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..264a0af
--- /dev/null
+++ b/Makefile
@@ -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-gen b/gal-gen
new file mode 100755 (executable)
index 0000000..af63d4c
--- /dev/null
+++ b/gal-gen
@@ -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-merge b/gal-merge
new file mode 100755 (executable)
index 0000000..26fc164
--- /dev/null
+++ b/gal-merge
@@ -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-scan b/gal-scan
new file mode 100755 (executable)
index 0000000..db41a0b
--- /dev/null
+++ b/gal-scan
@@ -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/nrt-blue/back.png b/nrt-blue/back.png
new file mode 100644 (file)
index 0000000..501909c
Binary files /dev/null and b/nrt-blue/back.png differ
diff --git a/nrt-blue/back.xcf b/nrt-blue/back.xcf
new file mode 100644 (file)
index 0000000..5d8848d
Binary files /dev/null and b/nrt-blue/back.xcf differ
diff --git a/nrt-blue/bot.png b/nrt-blue/bot.png
new file mode 100644 (file)
index 0000000..86bb5f2
Binary files /dev/null and b/nrt-blue/bot.png differ
diff --git a/nrt-blue/bot.xcf b/nrt-blue/bot.xcf
new file mode 100644 (file)
index 0000000..a3dbedc
Binary files /dev/null and b/nrt-blue/bot.xcf differ
diff --git a/nrt-blue/left.png b/nrt-blue/left.png
new file mode 100644 (file)
index 0000000..a9852c7
Binary files /dev/null and b/nrt-blue/left.png differ
diff --git a/nrt-blue/left.xcf b/nrt-blue/left.xcf
new file mode 100644 (file)
index 0000000..76912ed
Binary files /dev/null and b/nrt-blue/left.xcf differ
diff --git a/nrt-blue/next.png b/nrt-blue/next.png
new file mode 100644 (file)
index 0000000..bdd1011
Binary files /dev/null and b/nrt-blue/next.png differ
diff --git a/nrt-blue/next.xcf b/nrt-blue/next.xcf
new file mode 100644 (file)
index 0000000..ad06333
Binary files /dev/null and b/nrt-blue/next.xcf differ
diff --git a/nrt-blue/prev.png b/nrt-blue/prev.png
new file mode 100644 (file)
index 0000000..68b2514
Binary files /dev/null and b/nrt-blue/prev.png differ
diff --git a/nrt-blue/prev.xcf b/nrt-blue/prev.xcf
new file mode 100644 (file)
index 0000000..dbf35d5
Binary files /dev/null and b/nrt-blue/prev.xcf differ
diff --git a/nrt-blue/right.png b/nrt-blue/right.png
new file mode 100644 (file)
index 0000000..7af66ba
Binary files /dev/null and b/nrt-blue/right.png differ
diff --git a/nrt-blue/right.xcf b/nrt-blue/right.xcf
new file mode 100644 (file)
index 0000000..0668d05
Binary files /dev/null and b/nrt-blue/right.xcf differ
diff --git a/nrt-blue/style.css b/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/nrt-blue/theme.conf b/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/nrt-blue/theme.pm b/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/nrt-blue/top.png b/nrt-blue/top.png
new file mode 100644 (file)
index 0000000..db5a677
Binary files /dev/null and b/nrt-blue/top.png differ
diff --git a/nrt-blue/top.xcf b/nrt-blue/top.xcf
new file mode 100644 (file)
index 0000000..8298369
Binary files /dev/null and b/nrt-blue/top.xcf differ
diff --git a/nrt/back.png b/nrt/back.png
new file mode 100644 (file)
index 0000000..c0c4cee
Binary files /dev/null and b/nrt/back.png differ
diff --git a/nrt/bot.png b/nrt/bot.png
new file mode 100644 (file)
index 0000000..08c6683
Binary files /dev/null and b/nrt/bot.png differ
diff --git a/nrt/left.png b/nrt/left.png
new file mode 100644 (file)
index 0000000..3bd3aed
Binary files /dev/null and b/nrt/left.png differ
diff --git a/nrt/next.png b/nrt/next.png
new file mode 100644 (file)
index 0000000..72a4e39
Binary files /dev/null and b/nrt/next.png differ
diff --git a/nrt/prev.png b/nrt/prev.png
new file mode 100644 (file)
index 0000000..71e11cd
Binary files /dev/null and b/nrt/prev.png differ
diff --git a/nrt/right.png b/nrt/right.png
new file mode 100644 (file)
index 0000000..3e655dc
Binary files /dev/null and b/nrt/right.png differ
diff --git a/nrt/style.css b/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/nrt/theme.conf b/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/nrt/theme.pm b/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/nrt/top.png b/nrt/top.png
new file mode 100644 (file)
index 0000000..d8d5866
Binary files /dev/null and b/nrt/top.png differ