#!/bin/bash # # gal # Neil Gershenfeld 4/28/13 # script to make HTML galleries # # list pictures # rm -f files ls *JPG > files ls *jpg >> files ls *png >> files # # make thumbnails # echo "convert thumbnails:" awk "{ print \"convert -auto-orient -resize 140x100 \"\$0 \" th_\"\$0 \"\necho \" \$0}" files > conv sh conv rm conv # # make screen images # #echo "convert screen images:" #awk "{ print \"convert -auto-orient -resize 1024x768 \"\$0 \" sc_\"\$0 #\"\necho \" \$0}" files > conv #sh conv #rm conv # # orient images # echo "orient images:" awk "{ print \"convert -auto-orient \"\$0 \" \"\$0 \"\necho \" \$0}" files > conv sh conv rm conv # # add header # awk "{ system(\"echo '\n' > \" \$0 \".html\" ) }" files # # add image links # echo -e "\n" > index.html awk "{ print \"\" }" files >> index.html awk "{ system(\"echo '
' >> \" \$0 \".html\" ) }" files # # add index links # awk "{ system(\"echo '
index
' >> \" \$0 \".html\" ) }" files # # add last links # echo '
index
' > last awk "{ system(\"cat last >> \" \$0 \".html\"); system(\"echo '
last
' > last\") }" files # # add next links # echo '
index
' > next awk "{ line[NR] = \$0 } END { for (i = NR; i > 0; i--) print line[i] > \"revfiles\" }" files awk "{ system(\"cat next >> \" \$0 \".html\"); system(\"echo '
next
' > next\") }" revfiles # # link scripts # echo "
gal vid" >> index.html cp -f ~/bin/gal . cp -f ~/bin/vid . # # clean up # rm -f files revfiles last next