From cc60c16e927336c6ad052be8f9b6bc46ce1383e0 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 31 Oct 2007 00:14:55 +0100 Subject: [PATCH] Update to r10 of the gallery plugin, as per . --- CHANGELOG.gallery | 3 +++ IkiWiki/Plugin/gallery.pm | 13 +++++++++++-- README.gallery | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.gallery b/CHANGELOG.gallery index 8fce836b6..0a2c920ac 100644 --- a/CHANGELOG.gallery +++ b/CHANGELOG.gallery @@ -1,5 +1,8 @@ Project IkiWiki::gallery.pm =========================== +resize = "0" option included if no resize is intended. (use this if you face any problems with underlaydirs) +---- + Version 0.9 Support for resizing of images also included. Additional options : diff --git a/IkiWiki/Plugin/gallery.pm b/IkiWiki/Plugin/gallery.pm index b18dbaa73..4e4a8420c 100644 --- a/IkiWiki/Plugin/gallery.pm +++ b/IkiWiki/Plugin/gallery.pm @@ -143,7 +143,12 @@ sub makeGallery (@) {#{{{ my $vcs = $params{vcs} ; my $sort = $params{sort}; my $exif = $params{exif} || 1; - my $resize = $params{resize} || '800x600' ; + my $resize = $params{resize} || '800x600' ; + my $to_resize =1; + if (defined $params{resize} and $params{resize} == "0" ) { + $to_resize=0; + } + $vcs = 1 if not defined $vcs; my $dir = bestdir($params{page}, $imagedir,$vcs) || return "[[gallery ".sprintf(gettext("Directory %s not found"), $imagedir)."]]"; @@ -186,7 +191,9 @@ sub makeGallery (@) {#{{{ $imageoutlink = "$config{destdir}/$dir/${iw}x${ih}-$imagefile"; #Every image may not have this. will_render($params{page}, $thumblink); - will_render($params{page}, $resizedimagelink); + if($to_resize == 1 ) { + will_render($params{page}, $resizedimagelink); + } if (-e $thumboutlink && -e $imageoutlink && (-M sourcefile($imagelink,$vcs) >= -M $thumboutlink) && (-M sourcefile($imagelink,$vcs) >= -M $imageoutlink)) { $r = $im->Read($thumboutlink); @@ -200,6 +207,7 @@ sub makeGallery (@) {#{{{ my($imwidth,$imheight) = $im->Get('columns','rows'); my @blob; + if($to_resize == 1 ) { if($imwidth > $iw || $imheight > $ih) { my $temp1 = $imagelink ; $imagelink = "$dir/${iw}x${ih}-$imagefile"; @@ -213,6 +221,7 @@ sub makeGallery (@) {#{{{ $imagelink= $temp1; } } + } $r = $im->Resize(geometry => "${w}x${h}"); #Create Thumbnail return "[[gallery ".sprintf(gettext("Failed to resize: %s"), $r)."]]" if $r; diff --git a/README.gallery b/README.gallery index f8cb8857b..2b39f7fb4 100644 --- a/README.gallery +++ b/README.gallery @@ -15,7 +15,7 @@ Plugin can be used as Available options : - imagedir(required) => Directory containing images. It will scan all the files with jpg|png|gif extension from the directory and will put it in the gallery. - thumbnailsize(optional,Default=200x200) => Size of the thumbnail that you want to generate for the gallery. -- resize(optional, Default=>800x600) => Width and Height to resize image to. +- resize(optional, Default=>800x600) => Width and Height to resize image to or resize="0" for no resize - alt(optional) => If image can not be displayed, it will display the text contained in alt argument. - cols(optional,Default=3) => Number of columns of thumbnails that you want to generate. - rows(optional, Default=>3) => Number of Rows on a gallery page. -- 2.39.5