#!/bin/bash # GPLv3+ # Copyright 2009 Christian Franke TITLE="sublab rack" mkdir thumbs mkdir intimgs cd imgs MAX=0 for i in ./*; do SIZE=$(identify "$i" 2>&1 | cut -d ' ' -f3) if [ "$(expr match "${SIZE}" '\([0-9]*x[0-9]*\)' )" = ${SIZE} ]; then MAX=$((MAX+1)) fi done I=1 for i in *; do SIZE=$(identify "$i" 2>&1 | cut -d ' ' -f3) if [ "$(expr match "${SIZE}" '\([0-9]*x[0-9]*\)' )" = ${SIZE} ]; then SIZEX="$(echo $SIZE | cut -d x -f1)" SIZEY="$(echo $SIZE | cut -d x -f2)" while [ $SIZEX -ge 1021 ] || [ $SIZEY -ge 601 ]; do if [ $SIZEX -ge 1021 ]; then SIZEY=$(( $SIZEY*1020/$SIZEX )) SIZEX=1020 else SIZEX=$(( $SIZEX*600/$SIZEY )) SIZEY=600 fi done cat << "EOF" | sed "s/\\\$I/$I/g" | sed "s/\\\${TITLE}/$TITLE/g" > ../$I.html
|
EOF
[ $I -gt 1 ] && echo -e \
" \n |
Back to Overview |
EOF
[ $I -lt ${MAX} ] && echo -e \
" \n |
|
EOF
echo " " >> ../$I.html
echo " |
||
EOF
for i in $(seq 1 ${MAX}); do
echo "
" >> index.html
done
cat << "EOF" >> index.html