#!/bin/bash # create_gallery shell script v. 1.1, 2009-04-17_20:49 GMT+1 # (C) Steffen Wendzel # License: GPLv2, see http://www.gnu.org # # Requirements: # - bash shell # - netpbm # # Documentation: # 1. Create a folder bilder_orig where you place in your original pictures you want to publish # 2. For every file you want to add a comment (HTML title) to, create a file PIC_FILE.comment (PIC_FILE.title). E.g. your # picture is named bilder_orig/IMG_204.JPG then your comment file must be named bilder_orig/IMG_204.JPG.comment and a title containing file must be named bilder_orig/IMG_204.JPG.title. # 3. Run ./create_gallery [gallery title] in the base folder that contains the bilder_orig folder # (You can add a short description text in the 2nd parameter ($2 == argv[2]) if you want to do so) # 4. Upload all the *.html and *.jpg files (but not the bilder_orig folder) if [ "$1" = "" ]; then echo "Need a gallery name as argv[1]" exit 1 fi if [ "$2" = "" ]; then echo 'No description text given as argv[2] (not a problem)' fi echo '
'$2'
' >> index.html for file in `/bin/ls bilder_orig/*.[Jj][Pp][Gg]`; do file=`basename $file` echo ${file}... jpegtopnm bilder_orig/$file | pnmscale -width 640 -height 480 | pnmtojpeg --quality=90 > ${file}.big.jpg jpegtopnm ${file}.big.jpg | pnmscale -width 200 -height 150 | pnmtojpeg --quality=93 > ${file}.tiny.jpg echo '' > ${file}.html # check for a
' >> ${file}.html
# check for a comment set by the user
if [ -f bilder_orig/${file}.comment ]; then
echo '' >> ${file}.html cat bilder_orig/${file}.comment >> ${file}.html echo '
' >> ${file}.html fi echo '
' >> index.html
done
echo 'Gallery created with create_gallery.
' >> index.html echo '' >> index.html