Skip to content

Commit

Permalink
Item14246: add a {DefaultSize} config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Dec 5, 2016
1 parent 6fdf804 commit e8e01ac
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
14 changes: 7 additions & 7 deletions .gitignore
Expand Up @@ -2,10 +2,10 @@
*.swp
igp_*
pub/System/ImageGalleryPlugin/style.css
ImageGalleryPlugin.md5
ImageGalleryPlugin.sha1
ImageGalleryPlugin.tgz
ImageGalleryPlugin.txt
ImageGalleryPlugin.zip
ImageGalleryPlugin_installer
ImageGalleryPlugin_installer.pl
/ImageGalleryPlugin.md5
/ImageGalleryPlugin.sha1
/ImageGalleryPlugin.tgz
/ImageGalleryPlugin.txt
/ImageGalleryPlugin.zip
/ImageGalleryPlugin_installer
/ImageGalleryPlugin_installer.pl
5 changes: 3 additions & 2 deletions data/System/ImageGalleryPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1464689922" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1480692417" format="1.1" version="1"}%
---+!! <nop>ImageGalleryPlugin
%FORMFIELD{"Description"}%

Expand Down Expand Up @@ -166,8 +166,9 @@ Note, that the $comment variable will only display =&lt;comment&gt;= , that is w

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 05 Dec 2016 | added option ={DefaultSize}= |
| 27 May 2016 | added support for Foswiki:Extensions/JQPhotoSwipeContrib and Foswiki:Extensions/AngularSkin; \
improved support for Foswiki:Extensions/LazyLoadPlugin ;
improved support for Foswiki:Extensions/LazyLoadPlugin; \
fixed =frontend= parameter; added =class= parameter |
| 31 Aug 2015 | fixing deprecated unescaped left brace in regexes |
| 16 Dec 2014 | add support for svg, tiff, xcf and psd |
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/ImageGalleryPlugin.pm
Expand Up @@ -18,8 +18,8 @@ use strict;
use warnings;

# =========================
our $VERSION = '7.10';
our $RELEASE = '31 Aug 2015';
our $VERSION = '7.20';
our $RELEASE = '05 Dec 2015';
our $NO_PREFS_IN_TOPIC = 1;
our $SHORTDESCRIPTION = 'Displays image gallery with auto-generated thumbnails from attachments';
our $isInitialized;
Expand Down
4 changes: 4 additions & 0 deletions lib/Foswiki/Plugins/ImageGalleryPlugin/Config.spec
Expand Up @@ -12,6 +12,10 @@ $Foswiki::cfg{ImageGalleryPlugin}{ThumbSizes} = {
huge => '250x250',
};

# **STRING**
# Default thumbnail size to be used when no size parameter is specified to the %IMAGEGALLERY macro
$Foswiki::cfg{ImageGalleryPlugin}{DefaultSize} = 'large';

# **STRING**
# A pattern of filetype suffixes to be excluded from imagegalleries even though they are
# valid images
Expand Down
5 changes: 3 additions & 2 deletions lib/Foswiki/Plugins/ImageGalleryPlugin/Core.pm
Expand Up @@ -30,12 +30,12 @@ our %imageSuffixes;
# constructor
sub new {
my ($class, $id, $topic, $web) = @_;

my $this = bless({}, $class);

$web =~ s/\//\./go;

# init

$this->{id} = $id;
$this->{session} = $Foswiki::Plugins::SESSION;
$this->{query} = Foswiki::Func::getCgiQuery();
Expand All @@ -49,6 +49,7 @@ sub new {
$this->{imagesDir} = $this->{pubDir}.'/images';
$this->{pubUrlPath} = Foswiki::Func::getPubUrlPath();
$this->{foswikiWebName} = $Foswiki::cfg{SystemWebName};
$this->{defaultSize} = $Foswiki::cfg{ImageGalleryPlugin}{DefaultSize} // "medium";

my $defaultThumbSizes = $Foswiki::cfg{ImageGalleryPlugin}{ThumbSizes} // {};
# get predefined thumbnail sizes
Expand Down Expand Up @@ -147,7 +148,7 @@ sub init {

# read attributes
$this->{size} = $params->{size};
$this->{size} = 'medium' unless defined $this->{size};
$this->{size} = $this->{defaultSize} unless defined $this->{size};
my $thumbsize = $this->{thumbSizes}{$this->{size}} // $this->{size};
my $thumbwidth = 95;
my $thumbheight = 95;
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/ImageGalleryPlugin/build.pl
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!/usr/bin/env perl
#
# Build for ImageGalleryPlugin
#
Expand Down

0 comments on commit e8e01ac

Please sign in to comment.