#!/bin/ksh chmod +w * chmod +r * chgrp botany * for file in *.jpg do output=`echo $file | sed -e 's/.jpg/.gifs/'` if [[ ! -a $output ]] then echo "doing $file, outputting to $output" # bring the potentially old jpeg file up to date: touch $file djpeg -P $file | pnmscale -xysize 120 120 | ppmquant 256 | ppmtogif -interlace > $output fi done #for file in *.gif #do # output=`echo $file | sed -e 's/.gif/.gifs/'` # if [[ ! -a $output ]] then # echo "doing $file, outputting to $output" # # bring the potentially old gif file up to date: # touch $file # giftoppm $file | # pnmscale -xysize 120 120 | # ppmquant 256 | # ppmtogif -interlace > $output # fi # echo "interlacing $file" # cp $file $file.bak # giftoppm $file.bak | ppmtogif -interlace > $file #done #exit 1 for descfile in DESC* #for descfile in DESC.isao do cat $descfile | awk ' BEGIN { printed = 1; images = 0; for (element in image) { delete image[element] delete desc[element] } } /^[ ]*\#/ { # comment line next; } /^IMAGE:/ { sub("^IMAGE:[ ]*","",$0); sub("[ ]*$","",$0); image[++images] = $0; if (intext) { print "TEXT block not terminated"; exit } next; } /^PUB:/ { sub("^PUB:[ ]*","",$0); pub = $0; issue=""; date=""; page=""; if (intext) { print "TEXT block not terminated"; exit } next; } /^ISSUE:/ { sub("^ISSUE:[ ]*","",$0); issue = $0; if (intext) { print "TEXT block not terminated"; exit } next; } /^DATE:/ { sub("^DATE:[ ]*","",$0); date = $0 if (intext) { print "TEXT block not terminated"; exit } next; } /^PAGE:/ { sub("^PAGE:[ ]*","",$0); page = $0 if (intext) { print "TEXT block not terminated"; exit } next; } /^NAME:/ { sub("^NAME:[ ]*","",$0); printed = 0; name = $0 split($0, a) sub("\[","",a[1]) genus = tolower(substr(a[1],1,8)); if (intext) { print "TEXT block not terminated"; exit } next; } /^DESC:/ { sub("^DESC:[ ]*","",$0); desc[images] = $0; if (intext) { print "TEXT block not terminated"; exit } next; } /^CREDIT:/ { sub("^CREDIT:[ ]*","",$0); credit = $0 if (intext) { print "TEXT block not terminated"; exit } next; } /^TEXT:/ { intext++; text = "true" next; } /^\}$/ { intext=0; next; } /^$/ { if (intext) { print "

" } else if (!printed) { cmdstring = "mkdir " genus " 2>/dev/null" cmdstring | getline x cmdstring = "mkdir " genus "/pics" " 2>/dev/null" cmdstring | getline x cmdstring = "mkdir " genus "/pics_sm" " 2>/dev/null" cmdstring | getline x file = genus "/" image[1] sub(".gif",".htm",file); sub(".jpg",".htm",file); printed++; print " ", name, "image #" image[1] "" > file for (elements in image) { print elements, image[elements], desc[elements], genus thumb = image[elements] cmdstring = "cp " thumb " " genus "/pics" cmdstring | getline x oldthumb=thumb sub(".gifs",".gif",oldthumb); sub(".jpg",".gif",oldthumb); sub(".gif",".gifs",thumb); sub(".jpg",".gifs",thumb); cmdstring = "cp " thumb " " genus "/pics_sm/" oldthumb cmdstring | getline x print "
" >> file print "" >> file if (desc[elements] != "") { print "", desc[elements], "" >> file } print "" >> file } if (text != "") { #print "

Image Description

" >> file print "

" >> file while ((getline < "temp.process") == 1) { print $0 >> file } print "

" >> file system("rm -f temp.process") } if (credit != "" || pub != "" || issue != "" || date != "" || name != "" || page != "") { print "

Photo Info" >> file if (name != "") { print "
Name: ", name >> file } if (credit != "") { print "
Credit: ", credit >> file } if (pub != "") { print "
Pub: ", pub >> file } if (issue != "") { print "
Issue: ", issue >> file } if (page != "") { print "
Page: ", page >> file } if (date != "") { print "
Date: ", date >> file } print "

" >> file } text="" images = 0; for (element in image) { delete image[element] delete desc[element] } close(file); } next; } // { if (intext) { text = "true" print >> "temp.process" } else { ; } next; } ' done rm -f "temp.process" #shar -bcv *.gifs *.htm *.jpg > sharfile