#!/usr/bin/perl # Copyright © 2009-2011 by Daniel Friesel # License: WTFPL: # You just DO WHAT THE FUCK YOU WANT TO use strict; use warnings; use autodie; use App::Dthumb; use Getopt::Long qw(:config no_ignore_case); use IO::Handle; use Time::Progress; STDERR->autoflush(1); my $opt = {}; my $id = 1; GetOptions( $opt, qw{ help|h no-lightbox|L no-names|n quality|q=i size|d=i spacing|s=f title|t=s version|v }, ) or die("Please see perldoc -F $0\n"); my $dthumb = App::Dthumb->new($opt); my $timer = Time::Progress->new(); $dthumb->check_cmd_flags(); $dthumb->read_directories(); $dthumb->create_files(); $dthumb->delete_old_thumbnails(); $timer->attr( min => 1, max => scalar $dthumb->get_files(), ); for my $file ($dthumb->get_files()) { print STDERR $timer->report( "\r\e[KCreating Thumbnails: %p done, %L elapsed, %E remaining", $id++, ); $dthumb->create_thumbnail_html($file); $dthumb->create_thumbnail_image($file); } print "\n"; $dthumb->write_out_html(); __END__ =head1 NAME dthumb - Generate Thumbnails + Index for a set of images =head1 SYNOPSIS B [I] =head1 VERSION This manual documents B version 0.1 =head1 DESCRIPTION B will create an F with a list (thumbnails) of all images found in the current directory; the thumbnails will link to the images. It uses a javascript lightbox called B (see Ehttp://www.shadowbox-js.com/E) to display the images. To view the images without the lightbox, either disable javascript, use the B<-L> commandline switch or open images by clicking on the filename instead of the thumbnail. Note that recursion is not yet supported. During operation, B will show its progress on STDERR. =head1 OPTIONS =over =item B<-L>, B<--no-lightbox> Disable Javascript lightbox. Note that in the current implementations, this simple skips installation of the data files. The lightbox link in the HTML will still be written, leading to 404s on the server. This will be fixed. =item B<-n>, B<--no-names> Do not show image names below thumbnails =item B<-d>, B<--size> I Maximum thumbnail size (either width or height). Defaults to 200 =item B<-s>, B<--spacing> I Use I as spacing factor. The size of each image element (image + possible border around it) is the number of pixels (see --size) times I. So for B<1.1> you have a small border around each image, for B<1.0> you have no border at all, etc. Defaults to 1.1 =item B<-t>, B<--title> I Set HTML document title. Defaults to the basename of the current directory =item B<-q>, B<--quality> I Set thumbnail quality. Accepts values between 0 and 100, where 100 is the highest possible quality. Default is 75 =back =head1 EXIT STATUS Zero upon success, non-zero otherwise. =head1 CONFIGURATION None. =head1 FILES B always works in the current working directory. It will create the file F, in which the HTML code for the thumbnail list is saved. It also creates two directories: F<.thumbs> for the thumbnail images, and F<.dthumb>, which contains various data (so far icons and javascript code). =head1 DEPENDENCIES =over =item * autodie (Included in core as of perl 5.10.1) =item * Data::Section =item * Image::Imlib2 =item * Time::Progress =back =head1 BUGS AND LIMITATIONS Thumbnails of changed images are not yet recreated. Report issues either by mail to Ederf@chaosdorf.deE or on Ehttp://github.com/derf/dthumb/issuesE. =head1 AUTHOR Copyright (C) 2009-2011 by Daniel Friesel Ederf@chaosdorf.deE. The shadowbox code is (C) 2007-2010 by Michael J. I. Jackson. See Ehttp://www.shadowbox-js.com/E and especially Ehttp://www.shadowbox-js.com/LICENSEE. =head1 LICENSE 0. You just DO WHAT THE FUCK YOU WANT TO