From 9b243c81dac2a08e3cc1436d28903433b7c6f1da Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 8 Apr 2021 11:59:16 +0200 Subject: add optional HTML include header --- bin/dthumb | 5 +++++ lib/App/Dthumb.pm | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/dthumb b/bin/dthumb index 32931f9..6e94c84 100755 --- a/bin/dthumb +++ b/bin/dthumb @@ -24,6 +24,7 @@ GetOptions( $opt, qw{ all|a + header=s help|h no-names|n quality|q=i @@ -137,6 +138,10 @@ no border at all, etc. Set HTML document title. Defaults to the basename of the current directory +=item B<--header> I + +Include I contents in the generated HTML, right after the opening div tag. + =item B<-q>, B<--quality> I (default: 75) Set thumbnail quality. diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm index 0223016..74face3 100755 --- a/lib/App/Dthumb.pm +++ b/lib/App/Dthumb.pm @@ -7,7 +7,7 @@ use 5.010; use App::Dthumb::Data; use Cwd; use File::Copy qw(copy); -use File::Slurp qw(read_dir write_file); +use File::Slurp qw(read_dir read_file write_file); use Image::Imlib2; our $VERSION = '0.2'; @@ -45,6 +45,10 @@ sub new { $ref->{html} = $ref->{data}->get('html_start.dthumb'); + if ( $conf{header} ) { + $ref->{html} .= read_file( $conf{header} ); + } + return bless( $ref, $obj ); } -- cgit v1.2.3