summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-02-22 20:21:28 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-02-22 20:21:28 +0100
commit7fad3f17eb256fb25402fe4a4481a4b077502594 (patch)
tree09b44066445b9263d245a86972e75598d13a3db3
parent4af9fa661234fbcfc92b4e39cdb7c7a6f57a2ba6 (diff)
Remove thumbnails of deleted images
-rwxr-xr-xbin/dthumb17
1 files changed, 15 insertions, 2 deletions
diff --git a/bin/dthumb b/bin/dthumb
index 00f6b8b..06b7451 100755
--- a/bin/dthumb
+++ b/bin/dthumb
@@ -63,6 +63,20 @@ while (my $line = <DATA>) {
}
close($lightbox);
+if (-d $thumbdir) {
+ opendir(my $thumb_dh, $thumbdir);
+ for my $file (readdir($thumb_dh)) {
+ if ($file =~ qr{^\.}) {
+ next;
+ }
+
+ if (not -e $file) {
+ unlink("${thumbdir}/${file}");
+ }
+ }
+ closedir($thumb_dh);
+}
+
open(my $index, '>', $file_index);
print $index <<"EOD";
@@ -311,8 +325,7 @@ None.
=head1 BUGS AND LIMITATIONS
-There is no detection for changed images, the thumbnails of deleted images are
-not removed.
+Thumbnails of changed images are not yet recreated.
When used with B<-x>, the completer tar archive is kept in memory, leading to
enormous memory usage and possibly out-of-memory errors.