found 348724 0.99-svn060811-1
tags 348724 + upstream
tags 348724 + patch
thanks

Hi Francesco!

I cc:ed Apache::Gallery author, given that AFAIK the user mailing lists
does not work anymore <http://apachegallery.dk/?p=mailinglists>.

On Wed, 18 Jan 2006 17:42:23 +0100, Francesco Potorti` wrote:
> This wonderful patch does what I have wanted for some time: when
> GalleryUnderscoresToSpaces is set, it works for file names too, rather
> than for dir names only.

While this is the same as bug #337012 [1] (I was tempted to merge them),
there you asked two different things: first, GalleryUnderscoresToSpaces
working on file names as well and, second, support for file name
changing through a <file>.folder file.

[1] <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=337012#5>

So, I decided to leave the two bugs separated: I will change the title
of #337012 to reflect that it is about the second request above.

> The patch works for me, but does not include the required changes to
> the docs in Gallery.pm. the man page and the README.

Attached a new version of the patch ported to the latest upstream
version 1.0.1, with the necessary modifications to the docs as well.

On Wed, 02 Nov 2005 09:05:53 +0100, Francesco Potorti` wrote [1]:
> The feature provided by GalleryUnderscoresToSpaces for folder names
> would be very useful for file nemes too.
>
> Either the same switch could turn on that functionality for file names
> too, or a different switch could be used, for backwards compatibility.
> I would prefer the former.

I kept your choice of using the same switch for file names as well: I
agree that it is easier like this and that if Apache::Gallery replaces
underscores with spaces in directory names, it sounds "normal" that this
happens with file names as well.

In case the two features must be separated, I would prefer new variables
for both or, better, something like four possible values:

- none (= 0) to disable everything
- both (= 1) to enable everything
- dir for directory names only
- file for file names only

Michael, let me know if you prefer this latter solution and I will
provide a second patch on top of the one attached.

Thx, bye,
Gismo / Luca

diff -Naur Apache-Gallery-1.0.1.ORG/Changes Apache-Gallery-1.0.1/Changes
--- Apache-Gallery-1.0.1.ORG/Changes	2011-02-23 20:46:00.000000000 +0100
+++ Apache-Gallery-1.0.1/Changes	2011-03-15 03:08:58.821653838 +0100
@@ -3,6 +3,11 @@
 
 Revision history for Perl extension Apache::Gallery.
 
+1.0.2~1 Tue Mar 15 03:08:57 CET 2011
+
+	- Extended GalleryUnderscoresToSpaces to filenames as well.
+	  (Debian bug #348724, Francesco Potortì)
+
 1.0.1 Wed Feb 23 20:45:38 CET 2011
 
 	- Added missing template files to MANIFEST
diff -Naur Apache-Gallery-1.0.1.ORG/lib/Apache/Gallery.pm Apache-Gallery-1.0.1/lib/Apache/Gallery.pm
--- Apache-Gallery-1.0.1.ORG/lib/Apache/Gallery.pm	2011-02-23 20:46:15.000000000 +0100
+++ Apache-Gallery-1.0.1/lib/Apache/Gallery.pm	2011-03-15 03:02:49.684354406 +0100
@@ -385,11 +385,16 @@
 						$filetype = "unknown";
 					}
 
+					# Debian bug #348724 <http://bugs.debian.org/348724>
+					# not images
+					my $filetitle = $file;
+					$filetitle =~ s/_/ /g if $r->dir_config('GalleryUnderscoresToSpaces');
+
 					$tpl_vars{FILES} .=
 					     $templates{file}->fill_in(HASH => {%tpl_vars,
 										FILEURL => uri_escape($fileurl, $escape_rule),
 										ALT => "Size: $size Bytes",
-										FILE => $file,
+										FILE => $filetitle,
 										TYPE => $type,
 										FILETYPE => $filetype,
 									       }
@@ -408,8 +413,14 @@
 					my $cached = get_scaled_picture_name($thumbfilename, $thumbnailwidth, $thumbnailheight);
 
 					my $rotate = readfile_getnum($r, $imageinfo, $thumbfilename.".rotate");
+
+					# Debian bug #348724 <http://bugs.debian.org/348724>
+					# HTML <img> tag, alt attribute
+					my $filetitle = $file;
+					$filetitle =~ s/_/ /g if $r->dir_config('GalleryUnderscoresToSpaces');
+
 					my %file_vars = (FILEURL => uri_escape($fileurl, $escape_rule),
-							 FILE    => $file,
+							 FILE    => $filetitle,
 							 DATE    => $imageinfo->{DateTimeOriginal} ? $imageinfo->{DateTimeOriginal} : '', # should this really be a stat of the file instead of ''?
 							 SRC     => uri_escape($uri."/.cache/$cached", $escape_rule),
 							 HEIGHT => (grep($rotate==$_, (1, 3)) ? $thumbnailwidth : $thumbnailheight),
@@ -1897,7 +1908,8 @@
 =item B<GalleryUnderscoresToSpaces>
 
 Set this option to 1 to convert underscores to spaces in the listing
-of directory names.
+of directory and file names, as well as in the alt attribute for HTML
+<img> tags.
 
 =back
 
diff -Naur Apache-Gallery-1.0.1.ORG/README Apache-Gallery-1.0.1/README
--- Apache-Gallery-1.0.1.ORG/README	2011-02-22 21:56:38.000000000 +0100
+++ Apache-Gallery-1.0.1/README	2011-03-15 02:34:03.584862389 +0100
@@ -235,7 +235,8 @@
 
     GalleryUnderscoresToSpaces
         Set this option to 1 to convert underscores to spaces in the listing
-        of directory names.
+        of directory and file names, as well as in the alt attribute for HTML
+        <img> tags.
 
     GalleryCommentExifKey
     Set this option to e.g. ImageDescription to use this field as comments

Attachment: pgpYs2ObKXSOg.pgp
Description: PGP signature

Reply via email to