#!/bin/sh set -e list="`cat list`" sizes='t s m l' sizecmd() { djpeg $1 | pnmfile | sed 's/.*, //; s/ *maxval.*//; s/ by / x /' } sizecmd_xy() { djpeg $1 | pnmfile | sed 's/.*, //; s/ *maxval.*//; s/ by / /' } subdir=s set -- $list "" first=true while [ $# -gt 1 ] do prev="$i" i="$1" next="$2" shift bn=`basename $i .jpg` for s in s m l do case "$s" in s) dn=m ;; m) dn=l ;; l) dn=s ;; *) echo >&2 "$0: strange size: '$s'" exit 1 ;; esac exec > $subdir/$s.$i.html for j in $sizes do size=`sizecmd $subdir/$j.$bn.jpg` bytes=`stat -size $subdir/$j.$bn.jpg` kb=`expr '(' $bytes + 512 ')' / 1024` eval ${j}_size='"'$size'"' eval ${j}_KB=$kb done prev_page=$s.`basename $prev .jpg`.html next_page=$s.`basename $next .jpg`.html echo "
" if [ "$first" = "true" ] then echo "prev" else echo "prev" fi echo " |   index   | " if [ "$next" = "" ] then echo "next" else echo "next" fi echo " |
File | Width x Height | Size |
---|---|---|
$j.$bn.jpg | $wh | ($kb KB) |
" echo "\
" if [ "$first" = "true" ] then echo "prev" unset first else echo "prev" fi echo " |   index   | " if [ "$next" = "" ] then echo "next" else echo "next" fi echo " |
" if [ -f index_url ] then echo "index
" fi echo "
![]() |
"
if [ $n -eq 2 ]
then
echo "
index" fi if [ -f film.txt ] then echo "
Film: `{ cat film.txt; echo; } | sed 's/$/
/'` " fi if [ -f comments.txt ] then echo "
Comments: `{ cat comments.txt; echo; } | sed 's/$/
/` " fi