#!/bin/bash

for file in [0-9]*.png; do
  convert -size 960x540 $file                  -resize 960x540 half-${file%%.png}.png
  convert -size 480x270 half-${file%%.png}.png -resize 480x270 qtr-${file%%.png}.png
  convert -size 240x135 qtr-${file%%.png}.png  -resize 240x135 thumb-${file%%.png}.png
done

rm -f HEADER.html
echo '<table border="0" cellpadding="3" cellspacing="0" width="540" align="center">' > HEADER.html
for file in [0-9]*.png; do
   echo "<a href=\"qtr-${file%%.png}.png\" target=\"newLJA\"><img src=\"thumb-${file%%.png}.png\"></a> " >> HEADER.html
   echo "<a href=\"half-${file%%.png}.png\" target=\"newLJB\"><img src=\"thumb-${file%%.png}.png\"></a> " >> HEADER.html
   echo "<a href=\"$file\" target=\"newLJC\"><img src=\"thumb-${file%%.png}.png\"></a>" >> HEADER.html
   echo "<br>" >> HEADER.html
done