summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/dthumb1
-rwxr-xr-xlib/App/Dthumb.pm30
-rw-r--r--share/unknown.pngbin0 -> 6873 bytes
3 files changed, 23 insertions, 8 deletions
diff --git a/bin/dthumb b/bin/dthumb
index ab56865..f7ea418 100755
--- a/bin/dthumb
+++ b/bin/dthumb
@@ -23,6 +23,7 @@ our $VERSION = '0.2';
GetOptions(
$opt,
qw{
+ all|a
help|h
no-names|n
quality|q=i
diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm
index 6e4eeaf..a478c7d 100755
--- a/lib/App/Dthumb.pm
+++ b/lib/App/Dthumb.pm
@@ -56,8 +56,12 @@ sub read_directories {
if ( $file =~ m{ ^ [.] }x ) {
next;
}
+ if ( $file eq 'index.html' ) {
+ next;
+ }
if ( -f "${imgdir}/${file}"
- and $file =~ qr{ [.] (png | jp e? g) $ }iox )
+ and
+ ( $self->{config}{all} or $file =~ m{ [.] (png | jp e? g) $ }ix ) )
{
push( @files, $file );
}
@@ -68,7 +72,7 @@ sub read_directories {
if ( -d $thumbdir ) {
for my $file ( read_dir($thumbdir) ) {
- if ( $file =~ qr{^ [^.] }ox and not -f "${imgdir}/${file}" ) {
+ if ( $file =~ m{^ [^.] }ox and not -f "${imgdir}/${file}" ) {
push( @old_thumbs, $file );
}
}
@@ -127,13 +131,13 @@ sub create_thumbnail_html {
$self->{html} .= "<div class=\"image-container\">\n";
if ( -d $file ) {
- $self->{html}
- .= sprintf(
-"\t<a class=\"fancybox\" href=\"%s\" title=\"%s\" data-fancybox-group=\"gallery\">\n"
+ $self->{html} .= sprintf(
+ "\t<a href=\"%s\" title=\"%s\">\n"
. "\t\t<img src=\".dthumb/folder-blue.png\" alt=\"%s\" /></a>\n",
- ($file) x 2, $file, );
+ ($file) x 3,
+ );
}
- else {
+ elsif ( $file =~ m{ [.] (png | jp e? g) $ }ix ) {
$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",
@@ -142,6 +146,13 @@ sub create_thumbnail_html {
($file) x 2,
);
}
+ else {
+ $self->{html} .= sprintf(
+ "\t<a href=\"%s\" title=\"%s\">\n"
+ . "\t\t<img src=\".dthumb/unknown.png\" alt=\"%s\" /></a>\n",
+ ($file) x 3,
+ );
+ }
if ( $self->{config}->{names} or -d $file ) {
$self->{html} .= sprintf(
@@ -168,7 +179,10 @@ sub create_thumbnail_image {
{
return;
}
- if ( -d $file ) {
+ if ( -d $file
+ or $self->{config}{all}
+ and not( $file =~ m{ [.] (png | jp e? g) $ }ix ) )
+ {
return;
}
diff --git a/share/unknown.png b/share/unknown.png
new file mode 100644
index 0000000..50a2969
--- /dev/null
+++ b/share/unknown.png
Binary files differ