View Single Post
Old 10-12-2010, 07:20 PM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,584
i just run this from inside my main dir of pics

Code:
#!/bin/bash

JPGTN="no"

if [ ! -d thumb ]; then
  mkdir thumb
fi

function resize() { 
  if [ "$JPGTN" == "yes" ]; then
    jpgtn -d thumb -p $2. -f -s $1 -H "$i"
  elif [ "$JPGTN" == "no" ]; then
    convert -resize x$1 "$i" "thumb/$2.$i"
  else
    echo 'ERROR: set the $JPGTN variable to "yes" or "no"'
    exit -1
  fi
}

if [ -f "index.html" ]; then
  echo 'ERROR: index.html already exists'
  exit
fi

echo '- generating thumbnails'
for i in *.jpg; do echo $i; resize 150 thumb; done

echo '- generating small images'
for i in *.jpg; do echo $i; resize 640 small; done

echo '- generating indexes'

echo '<body bgcolor=white>' > index.html

for i in *.avi *.mpg *.mov; do
  if [ -f "$i" ]; then
    echo $i
    echo '<a href="'$i'">'$i'</a><br>' >> index.html
  fi
done

echo '<br>' >> index.html

for i in *.jpg; do 

  echo $i; 
  echo '<a href="'$(basename $i .jpg)'.html"><img src="thumb/thumb.'$i'" border=0></a>' >> index.html

  
  if [ "$CURRENT" ]; then
    PREVIOUS="$CURRENT"
  fi

  CURRENT="$(basename $i .jpg)"

  echo '<body bgcolor=white text="#CCCCCC" link="#CC0000" vlink="#CC0000" alink="#CC0000"><a href="indexx.html">homex</a> <a href="index.html">home</a><br>' > $CURRENT.html

  if [ "$PREVIOUS" ]; then
    sed -e s/index\.html/$CURRENT.html/ -e s/'home<'/'next<'/ $PREVIOUS.html > tmp
    mv tmp $PREVIOUS.html

    if [ -z "$FIRST" ]; then
      FIRST=$PREVIOUS
      sed -e s/indexx.html/index.html/ -e s/homex/home/ $PREVIOUS.html > tmp
      mv tmp $PREVIOUS.html
    fi

    sed -e s/indexx.html/$PREVIOUS.html/ -e s/homex/prev/ $CURRENT.html > tmp
    mv tmp $CURRENT.html
  fi

  echo '<a href="'$i'"><img src="thumb/small.'$i'" border=0></a>' >> $CURRENT.html

done
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


My Cam Feeds Script / Gallery Scraper / WPXXX Theme / Free Templates
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote