#!/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 \n " >> ../$I.html cat << "EOF" >> ../$I.html | Back to Overview | EOF [ $I -lt ${MAX} ] && echo -e \ " \n \n " >> ../$I.html cat << "EOF" >> ../$I.html |
EOF echo " " >> ../$I.html echo " " >> ../$I.html cat << "EOF" >> ../$I.html | ||
EOF for i in $(seq 1 ${MAX}); do echo " " >> index.html done cat << "EOF" >> index.html
EOF