From 0f20aa18617c649c270ab18e0c777907dcf99c94 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 27 Feb 2011 13:54:43 +0100 Subject: Add additional lightbox files, move everything but index.xhtml to .dthumb --- lib/App/Dthumb.pm | 20 ++++++++++++- lib/App/Dthumb/Data.pm | 76 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm index 2425800..0ec0ce3 100755 --- a/lib/App/Dthumb.pm +++ b/lib/App/Dthumb.pm @@ -37,6 +37,7 @@ sub new { $ref->{config}->{file_index} = 'index.xhtml'; $ref->{config}->{file_lightbox} = 'lightbox.js'; $ref->{config}->{dir_thumbs} = '.thumbs'; + $ref->{config}->{dir_data} = '.dthumb'; return bless($ref, $obj); } @@ -84,15 +85,32 @@ sub read_directories { sub create_files { my ($self) = @_; my $thumbdir = $self->{config}->{dir_thumbs}; + my $datadir = $self->{config}->{dir_data}; my $fh; if (not -d $thumbdir) { mkdir($thumbdir); } - open($fh, '>', 'lightbox.js'); + if (not -d $datadir) { + mkdir($datadir); + } + + open($fh, '>', "${datadir}/lightbox.js"); print {$fh} $self->{data}->lightbox(); close($fh); + + open($fh, '>', "${datadir}/overlay.png"); + print {$fh} $self->{data}->overlay_png(); + close($fh); + + open($fh, '>', "${datadir}/loading.gif"); + print {$fh} $self->{data}->loading_gif(); + close($fh); + + open($fh, '>', "${datadir}/close.gif"); + print {$fh} $self->{data}->close_gif(); + close($fh); } sub delete_old_thumbnails { diff --git a/lib/App/Dthumb/Data.pm b/lib/App/Dthumb/Data.pm index 85ab1d2..69877d5 100644 --- a/lib/App/Dthumb/Data.pm +++ b/lib/App/Dthumb/Data.pm @@ -5,6 +5,7 @@ use warnings; use base 'Exporter'; use Data::Section -setup; +use MIME::Base64 qw(decode_base64); our @EXPORT_OK = (); @@ -29,6 +30,21 @@ sub lightbox { return ${$self->section_data('lightbox.js')}; } +sub overlay_png { + my ($self) = @_; + return decode_base64(${$self->section_data('overlay.png')}); +} + +sub loading_gif { + my ($self) = @_; + return decode_base64(${$self->section_data('loading.gif')}); +} + +sub close_gif { + my ($self) = @_; + return decode_base64(${$self->section_data('close.gif')}); +} + 1; __DATA__ @@ -41,7 +57,7 @@ ______[ html_and_css ]______ dthumb - +