diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-02-27 18:09:36 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-02-27 18:09:36 +0100 |
commit | 48c650ef4122a31e7ef707b889a9806b90a58937 (patch) | |
tree | 1d336d14e770f4de5d669af653817793d0e856b4 | |
parent | ea2b05009684580d5db574fd361a0577d51cf271 (diff) |
Add (crude) option to disable lightbox
-rwxr-xr-x | bin/dthumb | 7 | ||||
-rwxr-xr-x | lib/App/Dthumb.pm | 18 |
2 files changed, 18 insertions, 7 deletions
@@ -16,6 +16,7 @@ GetOptions( help|h size|d=i spacing|s=f + no-lightbox|L no-names|n quality|q=i version|v @@ -48,6 +49,12 @@ Note that recursion is not yet supported. =over +=item B<-L>, B<--no-lightbox> + +Disable Javascript lightbox. Note that in the current implementations, this +simple skips installation of the data files. The lightbox link in the HTML +will still be written, leading to 404s on the server. This will be fixed. + =item B<-n>, B<--no-names> Do not show image names below thumbnails diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm index f26848f..ed1ed72 100755 --- a/lib/App/Dthumb.pm +++ b/lib/App/Dthumb.pm @@ -23,6 +23,7 @@ sub new { $conf->{size} //= 200; $conf->{spacing} //= 1.1; $conf->{quality} //= 75; + $conf->{lightbox} = !$conf->{'no-lightbox'}; $conf->{names} = !$conf->{'no-names'}; $ref->{config} = $conf; @@ -104,14 +105,17 @@ sub create_files { mkdir($thumbdir); } - if (not -d $datadir) { - mkdir($datadir); - } + if ($self->{config}->{lightbox}) { + + if (not -d $datadir) { + mkdir($datadir); + } - for my $file (qw(lightbox.js overlay.png loading.gif close.gif)) { - open(my $fh, '>', "${datadir}/${file}"); - print {$fh} $self->{data}->get($file); - close($fh); + for my $file (qw(lightbox.js overlay.png loading.gif close.gif)) { + open(my $fh, '>', "${datadir}/${file}"); + print {$fh} $self->{data}->get($file); + close($fh); + } } } |