#!/bin/sh
#
# VIEWSCREENS: Make a nice little entry thing for the photos.

if [ ! -f .disks ]
   then
   echo "No .disks file. Don't trust it."
   else

# If no T, just make one. And thumbnail.

if [ ! -d T ]
   then
   echo "Creating Thumbnail directory..."
   mkdir T
   cp *.jpg T
   cd T
   echo "Making the images Thumbnail-sized..."
   for each in *
   do
   mogrify -geometry 160 $each
   echo "$each....."
   done
   cd ..
fi

# If no M, just make one. And thumbnail.

if [ ! -d M ]
   then
   echo "Creating Medium (Display) directory..."
   mkdir M
   cp *.jpg M
   cd M
   echo "Making the images Medium-sized..."
   for each in *
   do
   mogrify -geometry 640 $each
   echo "$each....."
   done
   cd ..
fi

# Look for newbies

for each in *.jpg
    do
    if [ ! -f M/$each ]
       then
       echo "Adding Medium-Sized Version of $each..."
       cp $each M 
       mogrify -geometry 640 M/$each
    fi
    done

for each in *.jpg
    do
    if [ ! -f T/$each ]
       then
       echo "Adding Thumbnail-Sized Version of $each..."
       cp $each T 
       mogrify -geometry 160 T/$each
    fi
    done

 

# ----------------------------------------------------------------

O="index.html"

echo "<HTML><BODY BGCOLOR=#000000 TEXT=#00FF00 LINK=#FFFFEE VLINK=#EEEEDD ALINK=#EEEEDD>" >$O


echo "<CENTER><TABLE WIDTH=600>" >>$O

# If this is an "Album", it'll have a .album with the title in it. Use that.

if [ -f .album ]
   then
       echo "[%] This is an album. Using that format."
       echo "<TR><TD BGCOLOR=#FFFFFF>" >>$O
       echo "<TR><TD BGCOLOR=#003300 ALIGN=CENTER><FONT FACE=\"Arial\" COLOR=#DDDDDD SIZE=+1><B>`cat .album`" >>$O
       echo "<TR><TD BGCOLOR=#FFFFFF>" >>$O
fi

fi
