]> git.donarmstrong.com Git - deb_pkgs/libapache-gallery-perl.git/commitdiff
update to new version of Apache::Gallery
authorDon Armstrong <don@donarmstrong.com>
Wed, 16 Mar 2011 16:01:03 +0000 (16:01 +0000)
committerDon Armstrong <don@donarmstrong.com>
Wed, 16 Mar 2011 16:01:03 +0000 (16:01 +0000)
git-svn-id: file:///srv/don_svn/deb_pkgs/libapache-gallery-perl/trunk@540 8f7917da-ec0b-0410-a553-b9b0e350d17e

22 files changed:
Changes
LICENSE
MANIFEST
META.yml
README
TODO
UPGRADE
debian/changelog
lib/Apache/Gallery.pm
templates/bright/file.tpl
templates/bright/gallery.css
templates/bright/index.tpl
templates/bright/navdirectory.tpl [new file with mode: 0644]
templates/bright/rss.tpl [new file with mode: 0644]
templates/bright/rss_item.tpl [new file with mode: 0644]
templates/bright/showpicture.tpl
templates/default/file.tpl
templates/default/rss.tpl [new file with mode: 0644]
templates/default/rss_item.tpl [new file with mode: 0644]
templates/new/file.tpl
templates/new/rss.tpl [new file with mode: 0644]
templates/new/rss_item.tpl [new file with mode: 0644]

diff --git a/Changes b/Changes
index 9e221e4b4d1fb8efc9f47604a053c615b39bda07..f72b901a4b0d538c91cf0a6b5a1462c2db3d0b22 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,10 +1,27 @@
-$Author: mil $ $Rev: 308 $
-$Date: 2005-09-16 11:52:59 +0300 (Fri, 16 Sep 2005) $
+$Author: mil $ $Rev: 324 $
+$Date: 2011-02-22 21:56:06 +0100 (Tue, 22 Feb 2011) $
 
 Revision history for Perl extension Apache::Gallery.
 
+1.0.1 Wed Feb 23 20:45:38 CET 2011
+
+       - Added missing template files to MANIFEST
+
+1.0 Tue Feb 22 21:54:31 CET 2011
+
        - Handle files that match both GalleryDocFile and GalleryImgFile
          correctly. (Claus Faerber)
+       - Only respond to HEAD and GET requests, enabling users to use
+         WebDAV for upload (Andreas Plesner)
+       - Added new option GalleryCommentExifKey to get comments from
+         EXIF data (Michael Legart)
+       - Added new option GalleryEnableMediaRss to enable generation of
+         a media RSS feed for each directory listing. This works with
+         e.g. the plugin from http://piclens.com to enable 3D viewing
+         of your gallery. (Michael Legart)
+       - Make browser-caching work with mod_perl 2. Supports If-None-Match
+         and If-Modified-Since headers. Sets Last-Modified-Date and
+         ETag headers. (Michael Legart)
 
 1.0RC3 Fri Sep 16 10:27:48 CEST 2005
 
diff --git a/LICENSE b/LICENSE
index dc8e7d2baa4784679ff58b40084c7909c0e96160..e23da072ba4d0a02094650e8be63600451e87378 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
 $Author: mil $ $Rev: 255 $
-$Date: 2004-04-12 20:49:02 +0300 (Mon, 12 Apr 2004) $
+$Date: 2004-04-12 19:49:02 +0200 (Mon, 12 Apr 2004) $
 
 Apache::Gallery is free software and is released under the Artistic License. 
 See <http://www.perl.com/language/misc/Artistic.html> for details.
index 3043ef1e0507efd54c937dc246e0fc58eb13b060..0333722a4b6f11983f7921c7068838f6aee010fb 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
-MANIFEST
-INSTALL
-Makefile.PL
-TODO
-LICENSE
-README
 Changes
-lib/Apache/Gallery.pm
-UPGRADE
-htdocs/sound-ogg.png
-htdocs/video-wmv.png
-htdocs/video-asf.png
-htdocs/video-mov.png
-htdocs/application-pdf.png
+htdocs/agfolder.png
 htdocs/application-doc.png
+htdocs/application-pdf.png
+htdocs/application-rtf.png
+htdocs/c.png
 htdocs/sound-mp3.png
+htdocs/sound-ogg.png
 htdocs/sound-wav.png
-htdocs/application-rtf.png
+htdocs/video-asf.png
+htdocs/video-avi.png
+htdocs/video-mov.png
 htdocs/video-mpeg.png
 htdocs/video-mpg.png
-htdocs/video-avi.png
-htdocs/c.png
-htdocs/agfolder.png
-t/002_inpng.png
-t/005_jpg.jpg
-t/002_graphlibs.t
+htdocs/video-wmv.png
+INSTALL
+lib/Apache/Gallery.pm
+LICENSE
+Makefile.PL
+MANIFEST
+META.yml
+README
 t/001_use.t
-t/006_thumbnails.t
+t/002_graphlibs.t
 t/002_injpg.jpg
-t/004_cache_dir.t
+t/002_inpng.png
 t/003_comment.t
 t/003_commenttest
+t/004_cache_dir.t
 t/005_imageinfo.t
+t/005_jpg.jpg
+t/006_thumbnails.t
 t/007_pod.t
+templates/bright/dircomment.tpl
+templates/bright/directory.tpl
+templates/bright/error.tpl
+templates/bright/file.tpl
+templates/bright/gallery.css
+templates/bright/index.tpl
+templates/bright/info.tpl
+templates/bright/intervalactive.tpl
+templates/bright/interval.tpl
+templates/bright/layout.tpl
+templates/bright/navdirectory.tpl
+templates/bright/navpicture.tpl
+templates/bright/nodircomment.tpl
+templates/bright/nopictureinfo.tpl
+templates/bright/orig.tpl
+templates/bright/pictureinfo.tpl
+templates/bright/picture.tpl
+templates/bright/README
+templates/bright/refresh.tpl
+templates/bright/rss_item.tpl
+templates/bright/rss.tpl
+templates/bright/scaleactive.tpl
+templates/bright/scale.tpl
+templates/bright/showpicture.tpl
+templates/bright/slideshowisoff.tpl
+templates/bright/slideshowoff.tpl
 templates/default/dircomment.tpl
 templates/default/directory.tpl
 templates/default/error.tpl
 templates/default/file.tpl
+templates/default/gallery.css
 templates/default/index.tpl
 templates/default/info.tpl
-templates/default/interval.tpl
 templates/default/intervalactive.tpl
+templates/default/interval.tpl
 templates/default/layout.tpl
 templates/default/navpicture.tpl
 templates/default/nodircomment.tpl
 templates/default/nopictureinfo.tpl
 templates/default/orig.tpl
-templates/default/picture.tpl
 templates/default/pictureinfo.tpl
+templates/default/picture.tpl
 templates/default/refresh.tpl
-templates/default/scale.tpl
+templates/default/rss_item.tpl
+templates/default/rss.tpl
 templates/default/scaleactive.tpl
+templates/default/scale.tpl
 templates/default/showpicture.tpl
 templates/default/slideshowisoff.tpl
 templates/default/slideshowoff.tpl
-templates/default/gallery.css
-templates/new/intervalactive.tpl
 templates/new/dircomment.tpl
 templates/new/directory.tpl
 templates/new/error.tpl
 templates/new/file.tpl
+templates/new/gallery.css
 templates/new/index.tpl
 templates/new/info.tpl
+templates/new/intervalactive.tpl
 templates/new/interval.tpl
-templates/new/navpicture.tpl
 templates/new/layout.tpl
-templates/new/gallery.css
+templates/new/navpicture.tpl
 templates/new/nodircomment.tpl
 templates/new/nopictureinfo.tpl
 templates/new/orig.tpl
-templates/new/picture.tpl
 templates/new/pictureinfo.tpl
+templates/new/picture.tpl
 templates/new/refresh.tpl
-templates/new/scale.tpl
+templates/new/rss_item.tpl
+templates/new/rss.tpl
 templates/new/scaleactive.tpl
+templates/new/scale.tpl
 templates/new/showpicture.tpl
 templates/new/slideshowisoff.tpl
 templates/new/slideshowoff.tpl
-META.yml                                Module meta-data (added by MakeMaker)
+TODO
+UPGRADE
index 53e532ee918bd5806248f7fc38f02039ea652326..9541ad2c34851727c60d618dc3cab760be678e79 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,18 +1,29 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Apache-Gallery
-version:      1.0RC3
-version_from: lib/Apache/Gallery.pm
-installdirs:  site
+--- #YAML:1.0
+name:               Apache-Gallery
+version:            1.0.1
+abstract:           mod_perl handler to create an image gallery
+author:
+    - Michael Legart <michael@legart.dk>
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
 requires:
-    CGI:                           3.08
-    File::Spec:                    0
-    Image::Imlib2:                 1.02
-    Image::Info:                   0
-    Image::Size:                   0
-    Test::More:                    0
-    Text::Template:                0
-    URI:                           1.23
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+    CGI:             3.08
+    File::Spec:      0
+    Image::Imlib2:   1.02
+    Image::Info:     0
+    Image::Size:     0
+    Test::More:      0
+    Text::Template:  0
+    URI:             1.23
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.55_02
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4
diff --git a/README b/README
index 5572fe33080f082bac9f18574ba8016226da36aa..14877c61045fc26d0ef9a43c04096bff6930b42e 100644 (file)
--- a/README
+++ b/README
@@ -237,6 +237,14 @@ CONFIGURATION
         Set this option to 1 to convert underscores to spaces in the listing
         of directory names.
 
+    GalleryCommentExifKey
+    Set this option to e.g. ImageDescription to use this field as comments
+    for images.
+
+    GalleryEnableMediaRss
+    Set this option to 1 to enable generation of a media RSS feed. This can
+    be used e.g. together with the PicLens plugin from http://piclens.com
+
 FEATURES
     Rotate images
         Some cameras, like the Canon G3, detects the orientation of a
@@ -272,13 +280,17 @@ FEATURES
         Example:
 
                 TITLE: This is the new title of the page
-                And this is the comment.<br>
+                And this is the comment.<br />
                 And this is line two of the comment.
 
         The visible name of the folder is by default identical to the name
         of the folder, but can be changed by creating a file
         <directory>.folder with the visible name of the folder.
 
+        It is also possible to set GalleryCommentExifKey to the name of an
+        EXIF field containing the comment, e.g. ImageDescription. The EXIF
+        comment is overridden by the .comment file if it exists.
+
 DEPENDENCIES
     Perl 5
     Apache with mod_perl
diff --git a/TODO b/TODO
index 8b4f1e10bf5cb967a98c431656d480aa0c51704e..4a8e96ed273bb57436bab0e60def35487bfe9e11 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,5 @@
 $Author: mil $ $Rev: 255 $
-$Date: 2004-04-12 20:49:02 +0300 (Mon, 12 Apr 2004) $
+$Date: 2004-04-12 19:49:02 +0200 (Mon, 12 Apr 2004) $
 
 - Write a gallery-cleancache.pl script for removing entries in
   the cache where the original picture has been removed.
diff --git a/UPGRADE b/UPGRADE
index 6c82631e47c404a503769088f47c4101a06d3b47..4fed7fef4495f1db0fc5afc0646f89da703ab5fc 100644 (file)
--- a/UPGRADE
+++ b/UPGRADE
@@ -1,5 +1,5 @@
 # $Author: mil $ $Rev: 297 $
-# $Date: 2005-06-07 10:50:49 +0300 (Tue, 07 Jun 2005) $
+# $Date: 2005-06-07 09:50:49 +0200 (Tue, 07 Jun 2005) $
 
 For users upgrading to 1.0
 
index 7c3fff44bc17de6ce586d8cc6feb29effc08cec8..eb556b193f337e25a4dd54cebe6ee5b6ac9d77d2 100644 (file)
@@ -1,3 +1,9 @@
+libapache-gallery-perl (1.0.1-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Don Armstrong <don@debian.org>  Wed, 16 Mar 2011 08:59:31 -0700
+
 libapache-gallery-perl (0.99-svn060811-1) unstable; urgency=low
 
   * New svn pull release, pre 1.0.
index d543fcaa980519818f48c0516de7c3185df4917b..646ca0e059a0625608f428851bceeb13d37dd030 100644 (file)
@@ -1,13 +1,13 @@
 package Apache::Gallery;
 
-# $Author: mil $ $Rev: 316 $
-# $Date: 2006-08-04 16:28:06 +0300 (Fri, 04 Aug 2006) $
+# $Author: mil $ $Rev: 324 $
+# $Date: 2011-02-22 21:56:06 +0100 (Tue, 22 Feb 2011) $
 
 use strict;
 
 use vars qw($VERSION);
 
-$VERSION = "1.0RC3";
+$VERSION = "1.0.1";
 
 BEGIN {
 
@@ -25,7 +25,7 @@ BEGIN {
                require Apache2::SubRequest;
                require Apache2::Const;
        
-               Apache2::Const->import(-compile => 'OK','DECLINED','FORBIDDEN','NOT_FOUND');
+               Apache2::Const->import(-compile => 'OK','DECLINED','FORBIDDEN','NOT_FOUND','HTTP_NOT_MODIFIED');
 
                $::MP2 = 1;
        } else {
@@ -50,6 +50,9 @@ use POSIX qw(floor);
 use URI::Escape;
 use CGI;
 use CGI::Cookie;
+use Encode;
+use HTTP::Date;
+use Digest::MD5 qw(md5_base64);
 
 use Data::Dumper;
 
@@ -61,6 +64,10 @@ sub handler {
 
        my $r = shift or Apache2::RequestUtil->request();
 
+       unless (($r->method eq 'HEAD') or ($r->method eq 'GET')) {
+               return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
+       }
+
        if ((not $memoized) and ($r->dir_config('GalleryMemoize'))) {
                require Memoize;
                Memoize::memoize('get_imageinfo');
@@ -68,12 +75,14 @@ sub handler {
        }
 
        $r->headers_out->{"X-Powered-By"} = "apachegallery.dk $VERSION - Hest design!";
-       $r->headers_out->{"X-Gallery-Version"} = '$Rev: 316 $ $Date: 2006-08-04 16:28:06 +0300 (Fri, 04 Aug 2006) $';
+       $r->headers_out->{"X-Gallery-Version"} = '$Rev: 324 $ $Date: 2011-02-22 21:56:06 +0100 (Tue, 22 Feb 2011) $';
 
        my $filename = $r->filename;
        $filename =~ s/\/$//;
        my $topdir = $filename;
 
+       my $media_rss_enabled = $r->dir_config('GalleryEnableMediaRss');
+
        # Just return the http headers if the client requested that
        if ($r->header_only) {
 
@@ -81,7 +90,7 @@ sub handler {
                        $r->send_http_header;
                }
 
-       if (-f $filename or -d $filename) {
+               if (-f $filename or -d $filename) {
                        return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
                }
                else {
@@ -139,6 +148,20 @@ sub handler {
                $r->content_type($subr->content_type());
 
                if ($::MP2) {
+                       my $fileinfo = stat($file);
+
+                       my $nonce = md5_base64($fileinfo->ino.$fileinfo->mtime);
+                       if ($r->headers_in->{"If-None-Match"} eq $nonce) {
+                               return Apache2::Const::HTTP_NOT_MODIFIED();
+                       }
+
+                       if ($r->headers_in->{"If-Modified-Since"} && str2time($r->headers_in->{"If-Modified-Since"}) < $fileinfo->mtime) {
+                               return Apache2::Const::HTTP_NOT_MODIFIED();
+                       }
+
+                       $r->headers_out->{"Content-Length"} = $fileinfo->size; 
+                       $r->headers_out->{"Last-Modified-Date"} = time2str($fileinfo->mtime); 
+                       $r->headers_out->{"ETag"} = $nonce;
                        $r->sendfile($file);
                        return Apache2::Const::OK();
                }
@@ -185,13 +208,16 @@ sub handler {
                # Instead of reading the templates every single time
                # we need them, create a hash of template names and
                # the associated Text::Template objects.
-               my %templates = create_templates({layout    => "$tpl_dir/layout.tpl",
-                                                 index     => "$tpl_dir/index.tpl",
-                                                 directory => "$tpl_dir/directory.tpl",
-                                                 picture   => "$tpl_dir/picture.tpl",
-                                                 file      => "$tpl_dir/file.tpl",
-                                                 comment   => "$tpl_dir/dircomment.tpl",
-                                                 nocomment => "$tpl_dir/nodircomment.tpl",
+               my %templates = create_templates({layout       => "$tpl_dir/layout.tpl",
+                                                 index        => "$tpl_dir/index.tpl",
+                                                 directory    => "$tpl_dir/directory.tpl",
+                                                 picture      => "$tpl_dir/picture.tpl",
+                                                 file         => "$tpl_dir/file.tpl",
+                                                 comment      => "$tpl_dir/dircomment.tpl",
+                                                 nocomment    => "$tpl_dir/nodircomment.tpl",
+                                                 rss          => "$tpl_dir/rss.tpl",
+                                                 rss_item     => "$tpl_dir/rss_item.tpl",
+                                                 navdirectory => "$tpl_dir/navdirectory.tpl",
                                                 });
 
 
@@ -200,7 +226,11 @@ sub handler {
                my %tpl_vars;
 
                $tpl_vars{TITLE} = "Index of: $uri";
-               $tpl_vars{META} = " ";
+
+               if ($media_rss_enabled) {
+                       # Put the RSS feed on all directory listings
+                       $tpl_vars{META} = '<link rel="alternate" href="?rss=1" type="application/rss+xml" title="" id="gallery" />';
+               }
 
                unless (opendir (DIR, $filename)) {
                        show_error ($r, 500, $!, "Unable to access directory $filename: $!");
@@ -335,6 +365,7 @@ sub handler {
                                                                                    FILE    => $dirtitle,
                                                                                   }
                                                                           );
+
                                }
                                elsif (-f $thumbfilename && $thumbfilename =~ /$doc_pattern/i && $thumbfilename !~ /$img_pattern/i) {
                                        my $type = lc($1);
@@ -348,7 +379,7 @@ sub handler {
                                                $filetype = "text-$type";
                                        } elsif ($thumbfilename =~ m/\.(mp3|ogg|wav)$/i) {
                                                $filetype = "sound-$type";
-                                       } elsif ($thumbfilename =~ m/\.(doc|pdf|rtf|csv|eps)$/i) {
+                                       } elsif ($thumbfilename =~ m/$doc_pattern/i) {
                                                $filetype = "application-$type";
                                        } else {
                                                $filetype = "unknown";
@@ -388,6 +419,19 @@ sub handler {
                                                                                                 %file_vars,
                                                                                                },
                                                                                       );
+
+                                       if ($media_rss_enabled) {
+                                               my ($content_image_width, undef, $content_image_height) = get_image_display_size($cgi, $r, $width, $height);
+                                               my %item_vars = ( 
+                                                       THUMBNAIL => uri_escape($uri."/.cache/$cached", $escape_rule),
+                                                       LINK      => uri_escape($fileurl, $escape_rule),
+                                                       TITLE     => $file,
+                                                       CONTENT   => uri_escape($uri."/.cache/".$content_image_width."x".$content_image_height."-".$file, $escape_rule)
+                                               );
+                                               $tpl_vars{ITEMS} .= $templates{rss_item}->fill_in(HASH => { 
+                                                       %item_vars
+                                               });
+                                       }
                                }
                        }
                }
@@ -396,6 +440,70 @@ sub handler {
                        $tpl_vars{BROWSELINKS} = "";
                }
 
+               # Generate prev and next directory menu items
+               $filename =~ m/(.*)\/.*?$/;
+               my $parent_filename = $1;
+
+               $r->document_root =~ m/(.*)\/$/;
+               my $root_path = $1;
+               print STDERR "$filename vs $root_path\n";
+               if ($filename ne $root_path) {
+                       unless (opendir (PARENT_DIR, $parent_filename)) {
+                               show_error ($r, 500, $!, "Unable to access parent directory $parent_filename: $!");
+                               return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+                       }
+       
+                       my @neighbour_directories = grep { !/^\./ && -d "$parent_filename/$_" } readdir (PARENT_DIR);
+                       my $dirsortby;
+                       if (defined($r->dir_config('GalleryDirSortBy'))) {
+                               $dirsortby=$r->dir_config('GalleryDirSortBy');
+                       } else {
+                               $dirsortby=$r->dir_config('GallerySortBy');
+                       }
+                       if ($dirsortby && $dirsortby =~ m/^(size|atime|mtime|ctime)$/) {
+                               @neighbour_directories = map(/^\d+ (.*)/, sort map(stat("$parent_filename/$_")->$dirsortby()." $_", @neighbour_directories));
+                       } else {
+                               @neighbour_directories = sort @neighbour_directories;
+                       }
+
+                       closedir(PARENT_DIR);
+
+                       my $neightbour_counter = 0;
+                       foreach my $neighbour_directory (@neighbour_directories) {
+                               if ($parent_filename.'/'.$neighbour_directory eq $filename) {
+                                       if ($neightbour_counter > 0) {
+                                               print STDERR "prev directory is " .$neighbour_directories[$neightbour_counter-1] ."\n";
+                                               my $linktext = $neighbour_directories[$neightbour_counter-1];
+                                               if (-e $parent_filename.'/'.$neighbour_directories[$neightbour_counter-1] . ".folder") {
+                                                       $linktext = get_filecontent($parent_filename.'/'.$neighbour_directories[$neightbour_counter-1] . ".folder");
+                                               }
+                                               my %info = (
+                                               URL => "../".$neighbour_directories[$neightbour_counter-1],
+                                               LINK_NAME => "<<< $linktext",
+                                               DIR_FILES => "",
+                                               );
+                                               $tpl_vars{PREV_DIR_FILES} = $templates{navdirectory}->fill_in(HASH=> {%info});
+                                               print STDERR $tpl_vars{PREV_DIR_FILES} ."\n";
+
+                                       }
+                                       if ($neightbour_counter < scalar @neighbour_directories - 1) {
+                                               my $linktext = $neighbour_directories[$neightbour_counter+1];
+                                               if (-e $parent_filename.'/'.$neighbour_directories[$neightbour_counter-1] . ".folder") {
+                                                       $linktext = get_filecontent($parent_filename.'/'.$neighbour_directories[$neightbour_counter+1] . ".folder");
+                                               }
+                                               my %info = (
+                                               URL => "../".$neighbour_directories[$neightbour_counter+1],
+                                               LINK_NAME => "$linktext >>>",
+                                               DIR_FILES => "",
+                                               );
+                                               $tpl_vars{NEXT_DIR_FILES} = $templates{navdirectory}->fill_in(HASH=> {%info});
+                                               print STDERR "next directory is " .$neighbour_directories[$neightbour_counter+1] ."\n";
+                                       }
+                               }
+                               $neightbour_counter++;
+                       }
+               }
+
                if (-f $topdir . '.comment') {
                        my $comment_ref = get_comment($topdir . '.comment');
                        my %comment_vars;
@@ -407,11 +515,15 @@ sub handler {
                        $tpl_vars{DIRCOMMENT} = $templates{nocomment}->fill_in(HASH=>\%tpl_vars);
                }
 
-               $tpl_vars{MAIN} = $templates{index}->fill_in(HASH => \%tpl_vars);
-
-               $tpl_vars{MAIN} = $templates{layout}->fill_in(HASH => \%tpl_vars);
+               if ($cgi->param('rss')) {
+                       $tpl_vars{MAIN} = $templates{rss}->fill_in(HASH => \%tpl_vars);
+                       $r->content_type('application/rss+xml');
+               } else {
+                       $tpl_vars{MAIN} = $templates{index}->fill_in(HASH => \%tpl_vars);
+                       $tpl_vars{MAIN} = $templates{layout}->fill_in(HASH => \%tpl_vars);
+                       $r->content_type('text/html');
+               }
 
-               $r->content_type('text/html');
                $r->headers_out->{'Content-Length'} = length($tpl_vars{MAIN});
 
                if (!$::MP2) {
@@ -447,54 +559,10 @@ sub handler {
                }
 
                my ($orig_width, $orig_height, $type) = imgsize($filename);
-               my $width = $orig_width;
 
                my $imageinfo = get_imageinfo($r, $filename, $type, $orig_width, $orig_height);
 
-               my $original_size=$orig_height;
-               if ($orig_width>$orig_height) {
-                       $original_size=$orig_width;
-               }
-
-               # Check if the selected width is allowed
-               my @sizes = split (/ /, $r->dir_config('GallerySizes') ? $r->dir_config('GallerySizes') : '640 800 1024 1600');
-
-               my %cookies = fetch CGI::Cookie;
-
-               if ($cgi->param('width')) {
-                       unless ((grep $cgi->param('width') == $_, @sizes) or ($cgi->param('width') == $original_size)) {
-                               show_error($r, 200, "Invalid width", "The specified width is invalid");
-                               return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
-                       }
-
-                       $width = $cgi->param('width');
-                       my $cookie = new CGI::Cookie(-name => 'GallerySize', -value => $width, -expires => '+6M');
-                       $r->headers_out->{'Set-Cookie'} = $cookie;
-
-               } elsif ($cookies{'GallerySize'} && (grep $cookies{'GallerySize'}->value == $_, @sizes)) {
-
-                       $width = $cookies{'GallerySize'}->value;
-
-               } else {
-                       $width = $sizes[0];
-               }       
-
-               my $scale;
-               my $image_width;
-               if ($orig_width<$orig_height) {
-                       $scale = ($orig_height ? $width/$orig_height: 1);
-                       $image_width=$width*$orig_width/$orig_height;
-               }
-               else {
-                       $scale = ($orig_width ? $width/$orig_width : 1);
-                       $image_width = $width;
-               }
-
-               my $height = $orig_height * $scale;
-
-               $image_width = floor($image_width);
-               $width       = floor($width);
-               $height      = floor($height);
+               my ($image_width, $width, $height, $original_size) = get_image_display_size($cgi, $r, $orig_width, $orig_height);
 
                my $cached = get_scaled_picture_name($filename, $image_width, $height);
                
@@ -610,6 +678,9 @@ sub handler {
                        $foundcomment = 1;
                        $tpl_vars{COMMENT} = $comment_ref->{COMMENT} . '<br />' if $comment_ref->{COMMENT};
                        $tpl_vars{TITLE} = $comment_ref->{TITLE} if $comment_ref->{TITLE};
+               } elsif ($r->dir_config('GalleryCommentExifKey')) {
+                       my $comment = decode("utf8", $imageinfo->{$r->dir_config('GalleryCommentExifKey')});
+                       $tpl_vars{COMMENT} = encode("iso-8859-1", $comment);
                } else {
                        $tpl_vars{COMMENT} = '';
                }
@@ -677,6 +748,7 @@ sub handler {
                # Fill in sizes and determine if any are smaller than the
                # actual image. If they are, $scaleable=1
                my $scaleable = 0;
+               my @sizes = split (/ /, $r->dir_config('GallerySizes') ? $r->dir_config('GallerySizes') : '640 800 1024 1600');
                foreach my $size (@sizes) {
                        if ($size<=$original_size) {
                                my %sizes_vars;
@@ -970,6 +1042,59 @@ sub get_thumbnailsize {
        return ($width, $height);
 }
 
+sub get_image_display_size {
+       my ($cgi, $r, $orig_width, $orig_height) = @_;
+
+       my $width = $orig_width;
+
+       my $original_size=$orig_height;
+       if ($orig_width>$orig_height) {
+               $original_size=$orig_width;
+       }
+
+       # Check if the selected width is allowed
+       my @sizes = split (/ /, $r->dir_config('GallerySizes') ? $r->dir_config('GallerySizes') : '640 800 1024 1600');
+
+       my %cookies = fetch CGI::Cookie;
+
+       if ($cgi->param('width')) {
+               unless ((grep $cgi->param('width') == $_, @sizes) or ($cgi->param('width') == $original_size)) {
+                       show_error($r, 200, "Invalid width", "The specified width is invalid");
+                       return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
+               }
+
+               $width = $cgi->param('width');
+               my $cookie = new CGI::Cookie(-name => 'GallerySize', -value => $width, -expires => '+6M');
+               $r->headers_out->{'Set-Cookie'} = $cookie;
+
+       } elsif ($cookies{'GallerySize'} && (grep $cookies{'GallerySize'}->value == $_, @sizes)) {
+
+               $width = $cookies{'GallerySize'}->value;
+
+       } else {
+               $width = $sizes[0];
+       }       
+
+       my $scale;
+       my $image_width;
+       if ($orig_width<$orig_height) {
+               $scale = ($orig_height ? $width/$orig_height: 1);
+               $image_width=$width*$orig_width/$orig_height;
+       }
+       else {
+               $scale = ($orig_width ? $width/$orig_width : 1);
+               $image_width = $width;
+       }
+
+       my $height = $orig_height * $scale;
+
+       $image_width = floor($image_width);
+       $width       = floor($width);
+       $height      = floor($height);
+
+       return ($image_width, $width, $height, $original_size);
+}
+
 sub get_imageinfo {
        my ($r, $file, $type, $width, $height) = @_;
        my $imageinfo = {};
@@ -1193,11 +1318,13 @@ sub readfile_getnum {
 
        my $rotate = 0;
 
+       print STDERR "orientation: ".$imageinfo->{Orientation}."\n";
        # Check to see if the image contains the Orientation EXIF key,
        # but allow user to override using rotate
        if (!defined($r->dir_config("GalleryAutoRotate")) 
                || $r->dir_config("GalleryAutoRotate") eq "1") {
                if (defined($imageinfo->{Orientation})) {
+                       print STDERR $imageinfo->{Orientation}."\n";
                        if ($imageinfo->{Orientation} eq 'right_top') {
                                $rotate=1;
                        }       
@@ -1774,6 +1901,16 @@ of directory names.
 
 =back
 
+=item B<GalleryCommentExifKey>
+
+Set this option to e.g. ImageDescription to use this field as comments
+for images.
+
+=item B<GalleryEnableMediaRss>
+
+Set this option to 1 to enable generation of a media RSS feed. This
+can be used e.g. together with the PicLens plugin from http://piclens.com
+
 =head1 FEATURES
 
 =over 4
@@ -1822,6 +1959,10 @@ The visible name of the folder is by default identical to the name of
 the folder, but can be changed by creating a file <directory>.folder
 with the visible name of the folder.
 
+It is also possible to set GalleryCommentExifKey to the name of an EXIF
+field containing the comment, e.g. ImageDescription. The EXIF comment is
+overridden by the .comment file if it exists.
+
 =back
 
 =head1 DEPENDENCIES
index 04ff6640523930d64d7107b3aec7a2677e4f605c..cf34e76d8f7c6901c46509ff6c3c2b20fb73b0fa 100644 (file)
@@ -1 +1 @@
-    <div class="folder"><a href="{ $FILEURL }"><img border="0" alt="{ $ALT }" src="/icons/gallery/{ $FILETYPE }.png "><br />{ $FILE }</a></div>
+    <div class="folder"><a href="{ $FILEURL }"><img border="0" alt="{ $ALT }" src="/icons/gallery/{ $FILETYPE }.png " /><br />{ $FILE }</a></div>
index 5720dd0f8ed2717da12e663be1b89666cbbf4c8f..9d7d0241acc1a1fa3354d44c80c914702d77c445 100644 (file)
@@ -75,8 +75,16 @@ div.gallery-info:hover a {
 .img-info:hover {
        color: #000;
 }
+.comment {
+       margin-bottom: 5px;
+       font-size: 18px;
+}
+.comment:hover {
+       color: #000;
+       font-size: 18px;
+}
 .img-options {
-       margin-top: 5px;
+       margin-top: 10px;
        margin-bottom: 100px;
 }
 .img-options:hover {
@@ -99,6 +107,15 @@ div.gallery-info:hover a {
     top: 0px;
        width: 620px;
 }
+.directory-preview {
+    background-color: #fff;
+    border: 4px solid #ddd;
+    padding: 20px;
+    text-align: left;
+    top: 0px;
+    width: 200px;
+    height: 50px;
+}
 .thumb {
        float: left;
        text-align: center;
index fcebc08ccaf12f304029a19f92768f513bcbeb17..9175abfdfffacdee7774cda3228e23bffe903307 100644 (file)
@@ -8,16 +8,18 @@
 </div>
 <table>
   <tr>
+{ $PREV_DIR_FILES }
     <td id="directory">
       <div>
 { $FILES }
       </div>
     </td>
+{ $NEXT_DIR_FILES }
   </tr>
 </table>
   { $DIRCOMMENT }
 <div class="clr" />
 <div class="aginfo">
-               Indexed by <a href="http://apachegallery.dk">Apache::Gallery</a> - Copyright &copy; 2001-2006 Michael Legart - <a href="http://www.hestdesign.com/">Hest Design!</a>
+               Indexed by <a href="http://apachegallery.dk">Apache::Gallery</a> - Copyright &copy; 2001-2008 Michael Legart - <a href="http://www.hestdesign.com/">Hest Design!</a>
 </div>
 { $FORM_END }
diff --git a/templates/bright/navdirectory.tpl b/templates/bright/navdirectory.tpl
new file mode 100644 (file)
index 0000000..d7a1175
--- /dev/null
@@ -0,0 +1,6 @@
+    <td>
+          <div class="directory-preview">
+         <a href="{ $URL }">{ $LINK_NAME }</a>
+         { $DIR_FILES }
+               </div>
+    </td>
diff --git a/templates/bright/rss.tpl b/templates/bright/rss.tpl
new file mode 100644 (file)
index 0000000..c6c1b9d
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss" xmlns:atom="http://www.w3.org/2005/Atom">
+       <channel>
+       { $ITEMS }
+       </channel>
+</rss>
diff --git a/templates/bright/rss_item.tpl b/templates/bright/rss_item.tpl
new file mode 100644 (file)
index 0000000..02b9a51
--- /dev/null
@@ -0,0 +1,6 @@
+               <item>
+                       <title>{ $TITLE }</title>
+                       <link>{ $LINK }</link>
+                       <media:thumbnail url="{ $THUMBNAIL }"/>
+                       <media:content url="{ $CONTENT }"/>
+               </item> 
index 07019da90bdf0afff03d45f71b21c3ce7ea16631..ad2df0493a79716f24f2e0c41effd5affd62bb87 100644 (file)
@@ -34,5 +34,5 @@
 </div>
 
 <div class="aginfo">
-                 <a href="http://apachegallery.dk/">Apache::Gallery</a> &copy; 2001-2006 Michael Legart, <a href="http://www.hestdesign.com/">Hest Design</a>!
+                 <a href="http://apachegallery.dk/">Apache::Gallery</a> &copy; 2001-2008 Michael Legart, <a href="http://www.hestdesign.com/">Hest Design</a>!
 </div>
index 42a51943512911b16485112e7b8c13c92c4f2b9b..23c1b2cfe53b7383327a556758484d8bd8119f83 100644 (file)
@@ -1 +1 @@
-    <div id="folder"><a href="{ $FILEURL }"><img border="0" alt="{ $ALT }" src="/icons/gallery/{ $FILETYPE }.png"><br>{ $FILE }</a></div>
+    <div id="folder"><a href="{ $FILEURL }"><img border="0" alt="{ $ALT }" src="/icons/gallery/{ $FILETYPE }.png" /><br />{ $FILE }</a></div>
diff --git a/templates/default/rss.tpl b/templates/default/rss.tpl
new file mode 100644 (file)
index 0000000..c6c1b9d
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss" xmlns:atom="http://www.w3.org/2005/Atom">
+       <channel>
+       { $ITEMS }
+       </channel>
+</rss>
diff --git a/templates/default/rss_item.tpl b/templates/default/rss_item.tpl
new file mode 100644 (file)
index 0000000..02b9a51
--- /dev/null
@@ -0,0 +1,6 @@
+               <item>
+                       <title>{ $TITLE }</title>
+                       <link>{ $LINK }</link>
+                       <media:thumbnail url="{ $THUMBNAIL }"/>
+                       <media:content url="{ $CONTENT }"/>
+               </item> 
index cae88f44706a2829c84ad67d3120f44db28512da..cf34e76d8f7c6901c46509ff6c3c2b20fb73b0fa 100644 (file)
@@ -1 +1 @@
-    <div class="folder"><a href="{ $FILEURL }"><img border="0" alt="{ $ALT }" src="/icons/gallery/{ $FILETYPE }.png "><br>{ $FILE }</a></div>
+    <div class="folder"><a href="{ $FILEURL }"><img border="0" alt="{ $ALT }" src="/icons/gallery/{ $FILETYPE }.png " /><br />{ $FILE }</a></div>
diff --git a/templates/new/rss.tpl b/templates/new/rss.tpl
new file mode 100644 (file)
index 0000000..c6c1b9d
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss" xmlns:atom="http://www.w3.org/2005/Atom">
+       <channel>
+       { $ITEMS }
+       </channel>
+</rss>
diff --git a/templates/new/rss_item.tpl b/templates/new/rss_item.tpl
new file mode 100644 (file)
index 0000000..02b9a51
--- /dev/null
@@ -0,0 +1,6 @@
+               <item>
+                       <title>{ $TITLE }</title>
+                       <link>{ $LINK }</link>
+                       <media:thumbnail url="{ $THUMBNAIL }"/>
+                       <media:content url="{ $CONTENT }"/>
+               </item>