#!/bin/bash
#
# j2h For each "*.web.jpg" or "*.jpg" file in a directory, create an HTML
# page with the name of the jpg the same as the name of the html file, and
# put the jpg in the html.
#
# Copyright Date:
#Year="2002"
Year="$(date +%Y)"
if [ "$#" -lt "1" ]
then
echo "usage: $0 <images>"
echo ""
echo " For each image named, create a HTML page with the same name"
echo " as the image (.html extension) with the image embedded in the"
echo " HTML. Usually used for my thumbnail galleries, specifically"
echo " for \"*.web.jpg\" or \"*.jpg\" - the only file extensions it"
echo " knows how to deal with at this writing."
exit 1
fi
for pic in $*
do
tmp="${pic%.jpg}"
imgName="${tmp%.web}"
outHtml="${imgName}.html"
echo "
<html>
<head>
<title>${imgName}</title>
</head>
<body>
<h1>Image ${imgName}</h1>
<p>
</p>
<img src=\"${pic}\">
<h6>Image #${imgName}</h6>
<p>Image © ${Year}, Giles Orr</p>
</body>
</html>
" > ${outHtml}
done