9 # Find the latest N PNG thumbnails. Somewhat ineffective, but I assume
10 # we'll get to that later :-)
11 my @thumbnails = (sort { -M $a <=> -M $b } <$pdfweb::config::outputdir/*.png>);
12 my $real_show_last = scalar @thumbnails;
13 if ($real_show_last > $pdfweb::config::show_last) {
14 $real_show_last = $pdfweb::config::show_last;
17 # This is probably the simplest place to clean up files that we no longer
19 for my $t (@thumbnails[$pdfweb::config::show_last..$#thumbnails]) {
20 if (-M $t > $pdfweb::config::minimum_age) {
21 (my $base = $t) =~ s/\.png$//;
22 my @to_delete = <$base*>;
24 warn "Deleting " . join(', ', @to_delete);
29 # Sorry, no HTML templating. I didn't want to pull in yet another
33 Content-type: text/html; charset=utf-8
35 <?xml version="1.0" encoding="UTF-8" ?>
37 html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
38 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
39 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
41 <title>PDF converter : sesse.net</title>
42 <link rel="stylesheet" href="http://www.sesse.net/sesse.css" type="text/css" />
43 <link rel="stylesheet" href="pdfweb.css" type="text/css" />
44 <link rev="made" href="mailto:sgunderson\@bigfoot.com" />
45 <meta name="MSSmartTagsPreventParsing" content="TRUE" />
48 <h1>Last $real_show_last uploads</h1>
50 <p><a href="http://pdf.sesse.net/">Back to the converter</a></p>
53 for my $t (@thumbnails[0..$pdfweb::config::show_last-1]) {
54 (my $descname = $t) =~ s/\.png$/.desc/;
55 open DESC, "<$descname"
57 chomp (my $desc = <DESC>);
60 if (length($desc) > 30) {
61 $desc = substr($desc, 0, 30) . " ...";
63 $desc = HTML::Entities::encode_entities($desc);
65 my $time = (stat($t))[9];
66 my $date = POSIX::strftime("%Y-%m-%d %H:%M", localtime($time));
68 (my $pdfname = $t) =~ s/\.png$//;
71 <div class="pdfthumbnail">
72 <p class="thumb"><a href="output/$pdfname"><img src="output/$t" alt="PDF thumbnail" /></a></p>
73 <p class="desc">$desc</p>
74 <p class="date">$date</p>
81 <p class="copyright">Web PDF converter, © 2005 <a href="http://www.sesse.net/">Steinar H. Gunderson</a>.</p>