#!/usr/bin/perl -w #---------------------------------# # PROGRAM: flash_xml_maker.pl # # Eric Knibbe, May 2007 # #---------------------------------# # This program will, given a directory as an argument, generate an XML file # for use with the flash image gallery used for TFAVS (and possibly other) pages. # Note that images should be resized to 480 x 360 in this case. # Exit if no arguments specified if (!@ARGV) { print " Usage: flash_xml_maker.pl image_directory\n"; exit 1; } # Open the image directory, specified by the first argument $in_directory = $ARGV[0]; opendir INDIR, $in_directory or die "Cannot open $in_directory: $!"; @imagefiles = readdir INDIR; closedir INDIR; # Create an output file $xmlFile_fullpath = "$in_directory/../images.xml"; open OUTFILE, "> $xmlFile_fullpath"; print OUTFILE ''; print OUTFILE "\n\n"; foreach $image (@imagefiles) { # Skip any files with names starting with a period, or which aren't JPEGs next if $image =~ /^\./; next if !($image =~ /.jpg$|.jpeg$/i); # Process the image filenames into the XML file print OUTFILE "images/$image\n"; } print OUTFILE "\n"; print " Processing successful.\n"; close OUTFILE;