]> git.donarmstrong.com Git - deb_pkgs/libapache-gallery-perl.git/commitdiff
Add support for online renaming of images using .file
authorDon Armstrong <don@donarmstrong.com>
Thu, 2 Nov 2017 18:34:05 +0000 (11:34 -0700)
committerDon Armstrong <don@donarmstrong.com>
Thu, 2 Nov 2017 18:34:05 +0000 (11:34 -0700)
README
debian/changelog
lib/Apache/Gallery.pm

diff --git a/README b/README
index 64361e841a14b777a14403bdb05c4c48442a48d0..3910f39ae9f464360ce957180e3c6c46a8dc071f 100644 (file)
--- a/README
+++ b/README
@@ -292,6 +292,10 @@ FEATURES
         of the folder, but can be changed by creating a file
         <directory>.folder with the visible name of the folder.
 
+        Similarly, the visible name of any file is by default identical to the
+        name of the file, but can be changed by creating a file <file>.file
+        with the visible name of the file.
+
         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.
index 2a6e7ca9eba22c9cdf12698b454bf0ee6a12c99c..1a726d7e9d4c1d82f376158dbb7c20c7af8abd16 100644 (file)
@@ -4,6 +4,8 @@ libapache-gallery-perl (1.0.2-5) unstable; urgency=medium
   * Update standards version, no changes
   * Fix VCS urls
   * Add support for ?thumbonly to the debian package
+  * Add support for .file renaming of images. Thanks to Luca
+    Capello for the patch (Closes: #337012).
 
  --
 
index 88a03b4b71d1576ea12c6d94ee250879777711f2..3cb6e5638bb45dd3bf2c042ff786b0c7ef2435dd 100644 (file)
@@ -367,9 +367,14 @@ sub handler {
                                                $filetype = "unknown";
                                        }
 
-                                       # Debian bug #348724 <http://bugs.debian.org/348724>
+                                       # Debian bug #337012 <http://bugs.debian.org/337012>
                                        # not images
                                        my $filetitle = $file;
+                                       if (-e $thumbfilename . ".file") {
+                                               $filetitle = get_filecontent($thumbfilename . ".file");
+                                       }
+
+                                       # Debian bug #348724 <http://bugs.debian.org/348724>
                                        $filetitle =~ s/_/ /g if $r->dir_config('GalleryUnderscoresToSpaces');
 
                                        $tpl_vars{FILES} .=
@@ -397,9 +402,14 @@ sub handler {
 
                                        my $rotate = readfile_getnum($r, $imageinfo, $thumbfilename.".rotate");
 
-                                       # Debian bug #348724 <http://bugs.debian.org/348724>
+                                       # Debian bug #337012 <http://bugs.debian.org/337012>
                                        # HTML <img> tag, alt attribute
                                        my $filetitle = $file;
+                                       if (-e $thumbfilename . ".file") {
+                                               $filetitle = get_filecontent($thumbfilename . ".file");
+                                       }
+
+                                       # Debian bug #348724 <http://bugs.debian.org/348724>
                                        $filetitle =~ s/_/ /g if $r->dir_config('GalleryUnderscoresToSpaces');
 
                                        my %file_vars = (FILEURL => uri_escape($fileurl, $escape_rule),
@@ -640,9 +650,14 @@ sub handler {
                                        my ($thumbnailwidth, $thumbnailheight) = get_thumbnailsize($r, $orig_width, $orig_height);      
                                        my $imageinfo = get_imageinfo($r, $path.$prevpicture, $type, $orig_width, $orig_height);
                                        my $cached = get_scaled_picture_name($path.$prevpicture, $thumbnailwidth, $thumbnailheight);
+                                       # Debian bug #337012 <http://bugs.debian.org/337012>
+                                       my $prevpicture_title = $prevpicture;
+                                       if (-e $path."/".$prevpicture . ".file") {
+                                               $prevpicture_title = get_filecontent($path."/".$prevpicture . ".file");
+                                       }
                                        my %nav_vars;
                                        $nav_vars{URL}       = uri_escape($prevpicture, $escape_rule);
-                                       $nav_vars{FILENAME}  = $prevpicture;
+                                       $nav_vars{FILENAME}  = $prevpicture_title;
                                        $nav_vars{WIDTH}     = $width;
                                        $nav_vars{PICTURE}   = uri_escape(".cache/$cached", $escape_rule);
                                        $nav_vars{DIRECTION} = "&laquo; <u>p</u>rev";
@@ -663,9 +678,14 @@ sub handler {
                                        my ($thumbnailwidth, $thumbnailheight) = get_thumbnailsize($r, $orig_width, $orig_height);      
                                        my $imageinfo = get_imageinfo($r, $path.$nextpicture, $type, $thumbnailwidth, $thumbnailheight);
                                        my $cached = get_scaled_picture_name($path.$nextpicture, $thumbnailwidth, $thumbnailheight);
+                                       # Debian bug #337012 <http://bugs.debian.org/337012>
+                                       my $nextpicture_title = $nextpicture;
+                                       if (-e $path."/".$nextpicture . ".file") {
+                                               $nextpicture_title = get_filecontent($path."/".$nextpicture . ".file");
+                                       }
                                        my %nav_vars;
                                        $nav_vars{URL}       = uri_escape($nextpicture, $escape_rule);
-                                       $nav_vars{FILENAME}  = $nextpicture;
+                                       $nav_vars{FILENAME}  = $nextpicture_title;
                                        $nav_vars{WIDTH}     = $width;
                                        $nav_vars{PICTURE}   = uri_escape(".cache/$cached", $escape_rule);
                                        $nav_vars{DIRECTION} = "<u>n</u>ext &raquo;";
@@ -1480,6 +1500,10 @@ sub generate_menu {
        my $picturename;
        if (-f $filename) {
                $picturename = pop(@links);     
+               # Debian bug #337012 <http://bugs.debian.org/337012>
+               if (-e $filename . ".file") {
+                       $picturename = get_filecontent($filename . ".file");
+               }
        }
 
        if ($r->uri eq $root_path) {
@@ -2015,6 +2039,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.
 
+Similarly, the visible name of any file is by default identical to the
+name of the file, but can be changed by creating a file <file>.file
+with the visible name of the file.
+
 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.