#!/bin/sh album="$(dirname $QUERY_STRING)" name="$(basename $QUERY_STRING)" forsale=0 # pics in this album aren't for sale filelist="$album/.filelist" identify="/usr/local/bin/identify" exif="/tmp/showpic.exif.info.$$" scriptbc="/home/taylor/www/coloradoportraits.com/scriptbc.sh" PATH="$PATH:/bin:/usr/bin:/home/taylor/www/coloradoportraits.com"; export PATH trap "/bin/rm -f $exif" 0 getwidth() { width="$($identify "$1" | cut -d\ -f3 | sed 's/[^0-9]/ /g' | cut -d\ -f1)" echo $width } getsize() { height="$($identify "$1" | cut -d\ -f3 | sed 's/[^0-9]/ /g' | cut -d\ -f2)" width="$($identify "$1" | cut -d\ -f3 | sed 's/[^0-9]/ /g' | cut -d\ -f1)" ### If there's a reduction factor, add these lines: # height="$(expr $height / $reduce)" # width="$(expr $width / $reduce)" echo "height=\"$height\" width=\"$width\"" } nicename() { echo "$1" | sed -e 's/.[Jj][Pp][Gg]//' -e 's/-/ /g' -e 's/IMG_//' -e 's/DSC_//' -e 's/DSCF//' } showexif_popup() { return 0 # on the 'to do' list echo "

EXIF Information

" echo "
"
  cat $exif
  echo "
" echo "[exif]" } showexif() { $identify -format '%[exif:*]' "$1" > $exif echo "" if [ ! -s $exif ] ; then $identify -format "%c" "$1" | tr '\015' '\012' > $exif if [ -s $exif ] ; then exposure="$(grep 'Exposure Time' $exif | awk '{print $3}')" exposure="1/$(scriptbc $exposure)" fstop="$(grep 'F-Number' $exif | sed 's|/1$||')" focal="$(grep 'Focal Length' $exif | sed 's|/1$||')" if [ ! -z "$exposure" -a ! -z "$fstop" ] ; then echo "
" echo "$exposure, $fstop, $focal
" fi showexif_popup fi else exposure="$(grep 'ExposureTime' $exif | cut -d= -f2)" numerator="$(echo $exposure | cut -d/ -f1)" denominator="$(echo $exposure | cut -d/ -f2)" echo "" exposure="1/$($scriptbc -p 0 $denominator/$numerator)" fstop="$(grep 'FNumber' $exif | cut -d= -f2)" fstop="f$($scriptbc -p 1 $fstop | sed 's/.0$//')" focal="$(grep 'FocalLengthIn35mmFilm' $exif | cut -d= -f2)" takenmon="$(grep 'DateTimeOriginal' $exif|cut -d= -f2|cut -d: -f2)" takenday="$(grep 'DateTimeOriginal' $exif|cut -d= -f2|cut -d: -f3|cut -d\ -f1)" takenyear="$(grep 'DateTimeOriginal' $exif|cut -d= -f2|cut -d: -f1)" model="$(grep 'Model=' $exif | cut -d= -f2)" if [ ! -z $exposure -a ! -z $fstop -a ! -z $numerator ] ; then echo "
" echo "$exposure exposure at $fstop with focal range ${focal}mm" if [ ! -z $takenmon ] ; then echo "on $takenmon-$takenday-${takenyear}." fi echo "Camera: $model" showexif_popup echo "
" fi fi } echo "Content-type: text/html" echo "" if [ ! -z $(echo $album | grep -i newest) ] ; then # we're in the newest images folder, so we need to tweak some stuff echo "" name="$(echo $name | sed 's/Newest-Portfolio-Images\///')" album="$(echo $album | sed 's/Newest-Portfolio-Images\///')" realalbum="Newest Portfolio Images" filelist=".newest-filelist" newest="Newest-Portfolio-Images/" else realalbum="" newest="" fi nicename="$(nicename $name)" nicealbum="$(nicename $album)" echo "Colorado Portraits :: Boulder, Colorado :: " if [ ! -z "$realalbum" ] ; then echo "Photograph \"$nicename\" from Album \"$realalbum\"" else echo "Photograph \"$nicename\" from Album \"$nicealbum\"" fi cat << "EOF"
Colorado Portraits :: Boulder, Colorado
EOF if [ ! -z "$realalbum" ] ; then echo "Image \"$nicename\" from Album \"$realalbum\"
" else echo "Image \"$nicename\" from Album \"$nicealbum\"" fi echo "" echo "
" echo "
" # first off, let's figure out where this entry is in the filelist... match="$(grep -n "^$name$" $filelist | cut -d: -f1 )" if [ -z "$match" ] ; then match="$(grep -n "$name$" $filelist | cut -d: -f1 )" fi if [ "$match" -eq 1 ] ; then echo "no previous image" else minusone="$(expr $match - 1)" lastimage="$(sed -n "${minusone}p" < $filelist)" nicely="$(nicename $lastimage)" if [ ! -z "$newest" ] ; then echo "<< $nicely" else echo "<< $nicely" fi fi if [ ! -z "$realalbum" ] ; then echo " | $realalbum | " else echo " | $nicealbum | " fi matches="$(wc -l < $filelist | sed 's/[^0-9]//g')" # pics in album if [ "$match" -eq "$matches" ] ; then echo "no next image" else plusone="$(expr $match + 1)" nextimage="$(sed -n "${plusone}p" < $filelist)" nicely="$(nicename $nextimage)" if [ ! -z "$newest" ] ; then echo "$nicely >>" else echo "$nicely >>" fi fi echo "
" # Display the actual image itself: # useragent="$(echo $HTTP_USER_AGENT | grep "Windows")" echo "

" ## turn off display of name since the images aren't typically titled... # echo "
Image $nicename from Album \"$nicealbum\"
" # else # echo "color:#444'>Image $nicename" # fi # The information box echo "
" if [ -r $album/$name.info ] ; then cat "$album/$name.info" fi # now let's get the EXIF information, which is stuck in the 'comment' # field, as far as I can tell... echo "
" showexif "$album/$name" echo "
" echo "

" # commerce enabled, but not for the potraiture: if [ $forsale = 1 ] ; then if [ "$album" != "Portraiture" ] ; then cat << EOF
High-quality prints of this photograph are available
Only \$40 USD Only \$75 USD Only \$99 USD

Photographic prints are made on museum quality Fuji Crystal Archive Lustre paper and are shipped directly to any domestic US address via UPS second day - for free - in a heavy mailing tube. For an additional fee photos can be mailed anywhere in the world, and I'd be happy to mount the photograph prior to shipment: please contact me for details and a quote.
EOF fi fi # end of commerce enabling cat << EOF Portfolio Home


  All Content © 2009 by Dave Taylor. All Rights Reserved.

There have been EOF /home/taylor/www/coloradoportraits.com/counter cat << "EOF" portfolio viewings since 1 January, 2006.
EOF exit 0