summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-03-24 17:28:21 +0100
committerDaniel Friesel <derf@finalrewind.org>2017-03-24 17:28:21 +0100
commit3a7baab7344d933e9534716ddd9ff88645dcecfa (patch)
treede5c461b25307ad3464324d242e70815f5f20131 /lib
parenta1a881bde53bc5eddcd7be4c52a9ce8053ca9c53 (diff)
begin work on recursive mode. isn't recursive yet, but does list directories.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/App/Dthumb.pm34
1 files changed, 26 insertions, 8 deletions
diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm
index b6024a6..6e4eeaf 100755
--- a/lib/App/Dthumb.pm
+++ b/lib/App/Dthumb.pm
@@ -53,11 +53,17 @@ sub read_directories {
my ( @files, @old_thumbs );
for my $file ( read_dir($imgdir) ) {
+ if ( $file =~ m{ ^ [.] }x ) {
+ next;
+ }
if ( -f "${imgdir}/${file}"
and $file =~ qr{ [.] (png | jp e? g) $ }iox )
{
push( @files, $file );
}
+ elsif ( $self->{config}{recursive} and -d "${imgdir}/${file}" ) {
+ push( @files, $file );
+ }
}
if ( -d $thumbdir ) {
@@ -120,15 +126,24 @@ sub create_thumbnail_html {
$self->{html} .= "<div class=\"image-container\">\n";
- $self->{html} .= sprintf(
+ if ( -d $file ) {
+ $self->{html}
+ .= sprintf(
"\t<a class=\"fancybox\" href=\"%s\" title=\"%s\" data-fancybox-group=\"gallery\">\n"
- . "\t\t<img src=\"%s/%s\" alt=\"%s\" /></a>\n",
- ($file) x 2,
- $self->{config}->{dir_thumbs},
- ($file) x 2,
- );
+ . "\t\t<img src=\".dthumb/folder-blue.png\" alt=\"%s\" /></a>\n",
+ ($file) x 2, $file, );
+ }
+ else {
+ $self->{html} .= sprintf(
+"\t<a class=\"fancybox\" href=\"%s\" title=\"%s\" data-fancybox-group=\"gallery\">\n"
+ . "\t\t<img src=\"%s/%s\" alt=\"%s\" /></a>\n",
+ ($file) x 2,
+ $self->{config}->{dir_thumbs},
+ ($file) x 2,
+ );
+ }
- if ( $self->{config}->{names} ) {
+ if ( $self->{config}->{names} or -d $file ) {
$self->{html} .= sprintf(
"\t<br />\n" . "\t<a style=\"%s;\" href=\"%s\">%s</a>\n",
'text-decoration: none',
@@ -153,9 +168,12 @@ sub create_thumbnail_image {
{
return;
}
+ if ( -d $file ) {
+ return;
+ }
my $image = Image::Imlib2->load($file);
- my ( $dx, $dy ) = ( $image->width(), $image->height() );
+ my ( $dx, $dy ) = ( $image->width, $image->height );
my $thumb = $image;
if ( $dx > $thumb_dim or $dy > $thumb_dim ) {