X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=createpdf.pl;h=04233306b166270661faf91ef7dae00d855c21cc;hb=28bec6d326a508b3fa2877d6613b40e530881369;hp=6147e7e1938fd63b811658f41fced6ad985f6853;hpb=68190899b23c04803979149c4752bafb3cb0f4fb;p=webpdf diff --git a/createpdf.pl b/createpdf.pl index 6147e7e..0423330 100755 --- a/createpdf.pl +++ b/createpdf.pl @@ -155,6 +155,24 @@ EOF my $size = -s "output/$pdf_filename"; +if (defined($size) && $size > 0) { + # Make a thumbnail from the finished PDF, for later reference. (Output to + # stdout is so we make sure we get only the first page; it's the simplest + # hack I can find offhand. :-) ) + system("convert -resize 192x192 output/$pdf_filename png:- > output/$pdf_filename.png"); + open DESC, ">output/$pdf_filename.desc"; + + if ($url =~ /^http/i) { + $url =~ tr/\n//d; + print DESC "$url\n"; + } else { + $filename =~ tr/\n//d; + print DESC "$filename\n"; + } + + close DESC; +} + (my $sanitized_outname = $outname) =~ tr/a-zA-Z0-9. -/_/c; print "Content-type: application/pdf\n";