#!/usr/bin/perl -w #--------------------------------------------------------# # This script makes an html page of all pictures # # found in the FVTX directory tree, and # # - makes a thumbnail, # # - a clickable reference to the picture, # # - references to web pages where the picture is used # # # # September 2011 Hubert van Hecke # # # #--------------------------------------------------------# use File::stat; use Time::localtime; open FILE, ">all_pics.html"; # output file, print HTML header etc: print FILE ("
Thumbnail | Full path (starting at ...WWW/fvtx/) | Used in page:
");
$command = "rm *_thumb.jpg"; # get rid of the old thumbnails
system($command); #
# list of picture extensions:
@exts = ("jpg","JPG","jpeg","JPEG","png","gif","GIF");
$nexts = scalar(@exts); # array length
#$nexts = 1; # for short test runs
for ($jex=0; $jex<$nexts; $jex++) { # loop over icture types
$nskip = 0; # counters for
$skip = 0; # quick tests
# grab al list of files:
$command = "find ../ -name \"*.$exts[$jex]\" |";
open GRAB, $command; #
while (
| $fullname
| ");
# search for files where this picture is used:
$command = "find ../ -name \'*.html\' -exec grep -H \'$thumb_jpg\' {} \\; |";
#print ("command: $command \n");
$nlinks = 0;
open USEDIN, $command; # get the list of references
while ( |
"); } # exclude self-reference to all_pics } # loop over links close USEDIN; # none found: if ($nlinks<=1) { print FILE (" (not used)"); } print FILE (" "); # 'not used' test fails for duplicate names } # no self-reference } # no skip (test only) } # while grab - main loop over found files close GRAB; #print ("finished with GRAB\n"); } # loop over file types # finish the HTML code: print FILE (" |
---|