summaryrefslogtreecommitdiff
path: root/lib/App/Dthumb.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-02-27 16:06:01 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-02-27 16:06:01 +0100
commit2193d7f18ecb2e9ed325366f60d9dc4b35110df2 (patch)
tree70c2d1ae18d98b93adbd4a0ea4320dea33a99013 /lib/App/Dthumb.pm
parent7228e6e8354918943a6174fa0877b1edd6defe45 (diff)
Move data to share/, autocreate Data.pm during build process
Diffstat (limited to 'lib/App/Dthumb.pm')
-rwxr-xr-xlib/App/Dthumb.pm25
1 files changed, 7 insertions, 18 deletions
diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm
index d61fec5..5b493ee 100755
--- a/lib/App/Dthumb.pm
+++ b/lib/App/Dthumb.pm
@@ -30,7 +30,7 @@ sub new {
$ref->{data} = App::Dthumb::Data->new();
$ref->{tar} = Archive::Tar->new();
- $ref->{html} = $ref->{data}->html_start();
+ $ref->{html} = $ref->{data}->get('html_start');
$ref->{current_file_id} = 0;
@@ -86,7 +86,6 @@ 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);
@@ -96,21 +95,11 @@ sub create_files {
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);
+ 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);
+ }
}
sub delete_old_thumbnails {
@@ -191,7 +180,7 @@ sub create_thumbnail_image {
sub write_out_html {
my ($self) = @_;
- $self->{html} .= $self->{data}->html_end();
+ $self->{html} .= $self->{data}->get('html_end');
open(my $fh, '>', $self->{config}->{file_index});
print {$fh} $self->{html};