#!/bin/csh -f # make_index_htm_from_jpgs # ------------------------------------------------------------------------- # Shell script to create an index.htm file that shows thumbnails of all # images (JPG, GIF, PNG, etc.) in the current directory, pulling them # from the "thumbs" subdirectory where they are assumed to exist, and # having each thumbnail be a link to the full-sized image in this # directory. Output is written to stdout, so you may want to redirect # it to index.htm. Also, automatically prepends and appends the # optional files prependToIndex.htm and appendToIndex.htm. # ------------------------------------------------------------------------- # Revision History: # $Log$ # ------------------------------------------------------------------------- # Collect command line options set option_reverse_string = "" while ($#argv > 0) if ("$1" == "-h" || "$1" == "--help") then echo "Usage: $0:t [options] > index.htm" echo "Options:" echo " -h = Show this help text" echo " --help = Show this help text" echo " -r = Reverse sort order of images" echo " --reverse = Reverse sort order of images" exit 1 else if ("$1" == "-r" || "$1" == "--reverse") then shift set option_reverse_string = "-r" else if ("-" == "`echo $1:q | cut -c 1`") then echo "Error: Invalid option: $1:q" $0 --help exit 1 else # Not a recognized option. Assume it's the first argument break endif end # No arguments defined, so allow none if ($#argv > 0) then $0 -h exit 1 endif ls *.[jJ][pP][gG] *.[gG][iI][fF] *.[pP][nN][gG] >& /dev/null if ($status) then echo "No JPG, GIF or PNG files found. Nothing to do. Aborting..." exit 1 endif # Echo the following lines while expanding dollar sign vars # ?? Add below: cat < EOF if (-e prependToIndex.htm) then cat prependToIndex.htm endif # Echo the following lines while expanding dollar sign vars cat <
Slideshow Other Albums

EOF foreach image_file ("`ls $option_reverse_string *.[jJ][pP][gG] *.[gG][iI][fF] *.[pP][nN][gG]`") set txt_file = "${image_file:r}.txt" echo "" make_html_for_image_and_caption --thumbs "$image_file" "$txt_file" echo "" echo "" echo "" echo "" echo "" echo "" echo "" end set txt_file = overview.htm if (-e $txt_file:q) then echo "
" cat $txt_file:q endif set txt_file = overview.txt if (-e $txt_file:q) then echo "
" echo " " cat $txt_file:q echo " " endif if (-e appendToIndex.htm) then cat appendToIndex.htm endif # Echo the following lines while expanding dollar sign vars cat < EOF