#!/bin/sh
PGM=`basename $0`
case $1 in
# convert to jpg
xwd|bmp)
test -d image || mkdir image ;
ls -l -D "%Y%m%dT%H%M .jpg" x-* *.xwd *.bmp *.BMP \
| awk '{printf("%s %s%02d%s\n", $8, $6, NR, $7)}' | tee ./list ;
echo you can change the name by editing list ;
read a ;
awk '{printf("convert %s image/image-%s\n", $1, $2)}' ./list | sh ;
awk '{printf("convert %s -resize 34080@ image/thumbnail-%s\n", $1, $2)}' ./list | sh ;
ls image ;
;;
photo)
test -d photo || mkdir photo ;
ls -l -D "%Y%m%dT%H%M .jpg" *.jpg *.JPG \
| awk '{printf("%s %s%02d%s\n", $8, $6, NR, $7)}' | tee ./list ;
echo you can change the name by editing list ;
read a ;
awk '{printf("convert %s -trim -resize 307200@ photo/photo-%s\n", $1, $2)}' ./list | sh ;
awk '{printf("convert %s -trim -resize 34080@ photo/thumbnail-%s\n", $1, $2)}' ./list | sh ;
ls photo ;
;;
*)
echo Usage: $PGM xwd, $PGM bmp, $PGM photo ;
exit 1 ;
;;
esac;
# make sample HTML
case $1 in
xwd|bmp)
cd image ;
identify -format "
\n" thumbnail-*.jpg | sed -e 's/thumbnail-/image-/' -e 's/.jpg/.html/' > sample.html ;
identify -format "%f %w %h %f\n" image-*.jpg | sed 's/.jpg/.html/' | sed -n '/./p' > /tmp/identify-list.txt ;
;;
photo)
cd photo ;
identify -format "
\n" thumbnail-*.jpg | sed -e 's/thumbnail-/photo-/' -e 's/.jpg/.html/' > sample.html ;
identify -format "%f %w %h %f\n" photo-*.jpg | sed 's/.jpg/.html/' | sed -n '/./p' > /tmp/identify-list.txt ;
;;
esac;
sed 's/ align="right"//' sample.html > a.html
awk -f $HOME/bin/index-generate.awk /tmp/identify-list.txt
# Also make HTML for parent directory
case $1 in
xwd|bmp)
(sed 's/\"\.\//\"\.\/image\//g' sample.html > ../sample.html ) ;
;;
photo)
(sed 's/\"\.\//\"\.\/photo\//g' sample.html > ../sample.html) ;
;;
esac;
cd ..
sed 's/ align="right"//' sample.html > a.html