From 8d58658159ed9f4e23957531e154377b2357685d Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 28 Sep 2011 19:35:22 +0000 Subject: [PATCH] Change underscores to spaces for images too (Closes: #348724) git-svn-id: file:///srv/don_svn/deb_pkgs/libapache-gallery-perl/trunk@559 8f7917da-ec0b-0410-a553-b9b0e350d17e --- Changes | 5 +++++ README | 3 ++- debian/changelog | 5 +++-- lib/Apache/Gallery.pm | 18 +++++++++++++++--- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index f72b901..61946a6 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,11 @@ $Date: 2011-02-22 21:56:06 +0100 (Tue, 22 Feb 2011) $ 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 --git a/README b/README index 14877c6..dcbc89d 100644 --- a/README +++ b/README @@ -235,7 +235,8 @@ CONFIGURATION 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 + tags. GalleryCommentExifKey Set this option to e.g. ImageDescription to use this field as comments diff --git a/debian/changelog b/debian/changelog index eb556b1..7b972db 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ -libapache-gallery-perl (1.0.1-1) UNRELEASED; urgency=low +libapache-gallery-perl (1.0.1-1) unstable; urgency=low * New upstream release + * Change underscores to spaces for images too (Closes: #348724) - -- Don Armstrong Wed, 16 Mar 2011 08:59:31 -0700 + -- Don Armstrong Wed, 28 Sep 2011 12:34:55 -0700 libapache-gallery-perl (0.99-svn060811-1) unstable; urgency=low diff --git a/lib/Apache/Gallery.pm b/lib/Apache/Gallery.pm index 646ca0e..8826d4a 100644 --- a/lib/Apache/Gallery.pm +++ b/lib/Apache/Gallery.pm @@ -385,11 +385,16 @@ sub handler { $filetype = "unknown"; } + # Debian bug #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 @@ sub handler { my $cached = get_scaled_picture_name($thumbfilename, $thumbnailwidth, $thumbnailheight); my $rotate = readfile_getnum($r, $imageinfo, $thumbfilename.".rotate"); + + # Debian bug #348724 + # HTML 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 @@ Quality at 50: =item B 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 + tags. =back -- 2.39.2