Diff for /scripts/pgallery/src/pgallery.sh between versions 1.9 and 1.18

version 1.9, 2012/08/28 17:37:11 version 1.18, 2012/08/31 12:33:07
Line 5 Line 5
 # can do whatever you want with this stuff. If we meet some day, and you think  # can do whatever you want with this stuff. If we meet some day, and you think
 # this stuff is worth it, you can buy me a beer in return Aron Schlesinger  # this stuff is worth it, you can buy me a beer in return Aron Schlesinger
 #  #
# $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.8 2012/08/28 17:29:32 as Exp $# $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.17 2012/08/29 14:44:04 as Exp $
 #  #
   . $(dirname $0)/libpgallery
   
 ARG_TITLE="PGallery"  ARG_TITLE="PGallery"
 ARG_FILES=  ARG_FILES=
Line 24  ARG_MAILTO="" Line 25  ARG_MAILTO=""
 ARG_MAILFROM="PGallery <${USER}@${HOST}>"  ARG_MAILFROM="PGallery <${USER}@${HOST}>"
 ARG_URL=  ARG_URL=
 ARG_EXIF="0x920a 0x829d 0x829a ISO 0x8827 / 0x010f - 0x0110"  ARG_EXIF="0x920a 0x829d 0x829a ISO 0x8827 / 0x010f - 0x0110"
   ARG_INDEXIMG=
   
 BIN_CONVERT="/usr/local/bin/convert"  
 BIN_EXIFAUTOTRAN="/usr/local/bin/exifautotran"  
 BIN_IMGINFO="/usr/local/bin/imginfo"  
 BIN_SENDMAIL="/usr/sbin/sendmail"  
 BIN_EXIFTRAN="/usr/local/bin/exiftran"  
 BIN_EXIF="/usr/local/bin/exif"  
   
 MKAKEFILE=".htmakefile"  MKAKEFILE=".htmakefile"
 VERSION="pgallery-1.2"  
   
 #  #
 # usage()  # usage()
Line 56  Options: Line 50  Options:
   -h            this page    -h            this page
   -i name       index file name (default: $ARG_INDEX)    -i name       index file name (default: $ARG_INDEX)
   -l url        gallery link    -l url        gallery link
     -m image      image for pgalleryindex. default the first image
   -n name       page title (default: $ARG_TITLE)    -n name       page title (default: $ARG_TITLE)
   -s suffix     list of suffix. if no \`\`-f'' defined, used to find images    -s suffix     list of suffix. if no \`\`-f'' defined, used to find images
                 in \`\`-d'' directoy. case insensitive                  in \`\`-d'' directoy. case insensitive
Line 69  Options: Line 64  Options:
                 the syntax of the file is MAKE(1)                  the syntax of the file is MAKE(1)
                 supported variable: TITLE COPYRIGHT INDEX FILETYPES TNSIZE URL                  supported variable: TITLE COPYRIGHT INDEX FILETYPES TNSIZE URL
                                     TNQALITY BIGSIZE BIGQALITY MAILTO MAILFROM                                      TNQALITY BIGSIZE BIGQALITY MAILTO MAILFROM
                                    EXIF                                    EXIF INDEXIMG
   -T mailto     send update infos to this address. if not set, no mail delivery    -T mailto     send update infos to this address. if not set, no mail delivery
   -U            no update, new calculation of all images.    -U            no update, new calculation of all images.
                 normally only new and modified images will calculated                  normally only new and modified images will calculated
Line 77  USAGE Line 72  USAGE
         exit          exit
 }  }
   
## first find image dir
# get_my_path()is_dir=0
#for arg in $*
get_my_path()do
{        if [ $is_dir -eq 1 ]
        current=$(pwd) 
        cd $(dirname $0) 
        echo $(pwd)/$(basename $0) 
        cd "$current" 
} 
 
# 
# html_header() 
# 
html_header() 
{ 
        cat <<HTML 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
        <title>$ARG_TITLE</title> 
                <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> 
                <style type="text/css"> 
                <!-- 
body { 
        background-color: #464646; 
        background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYB\ 
AMAAACDuy0HAAAAG1BMVEX+/v4BAQH///8KCgoDAwN/f3/19fWAgID8/PzhDwT2AAAACXRSTlMFBQUFBQU\ 
FBQWHDtP9AAALwklEQVR4Xg3KOWOyWhAA0Bn2ci57eXEvQY1JCZp8sQTjVoJLTAkaE0swbj/7ve4UB37FL\ 
W4q86Lwwlh86J/ASAkpWaj+Kr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jxjO05MSX1IaTeDmTRGEeK\ 
vAvtaaBaLQnjftGJz+4cjFyy6/iCjLGF2/gW+jQhEUxbEBPyQzXi+Bb4kc9wK4jIwNLWbwQAOtYKRLaipD\ 
H+X4TPPOG8DCNY4IC9yBk1qcibjhUgRnDcf35pl9d5otbvQjOIXlEu5dVtm5LRaK5KWcD/PX6LaGd25CuN\ 
HG/vgeIB1kcpCme+J8idlcjfBALAJSggznsGHGOAJgdGduMnZg+bAaeGASGV9bh/X2wPsVTmBLxmTTQsBG\ 
FkEOkZJTsGAm+HrtMDbWwvTXOutX1u7BxIq9Xib6DkFMbUitNdrYsULkahsAhBEh9FjdzL9BNARxTSr7T3\ 
u1rE+IWUmCIpwTZHZCu5l9THCuCcOhZqfekuQxjQ7EoyGUJAwCv/q1JOuJeCc/3lknb76zAquO/DAQhK/6\ 
2cP8X2s3+IBLIhvL8RHopoHpIArJysYTTmMMeubPXh8W760AvMVH67jqgg06+/ne5MZ631z6yROhloh3dP\ 
QirZoEpr80wgt/cEbhbAQTmRLtGh8lxCwDBBb5OeJ4aEq25XBNMT2rzWedW2zIzj+CCDKlnlyJBzT81qBW\ 
p69h7vlb3TmEV+DNm2rqj1iT7BQuwVVsuPkwq1e5P8tgNjVbIlMzwXeM11kZqjx3KKFOJzc3CAyFVhi8fx\ 
VZ5FvhdAM5mM6kS6OgKu16MFglq3/b/QVIwdw7HUCyeW04JPjC5dO+GC9OfqfB4VX+wwuift+ths2Ss3i6\ 
nkOE+JFyD+wKFL+WMX6nwwDva0S1/O8Mlnida69Ph96fuFvCoRMvXnCfsLPPmC/hA5RnMNE4fDK0pVOQ4B\ 
HLaErzv/wD99ABmjNZk0AAAAABJRU5ErkJggg=="); 
        margin: 10px auto; 
        font-family: Geneva,Arial,sans-serif; 
        font-size: 12px; 
        text-shadow: 1px 1px 1px #000; 
        color: #808080; 
} 
div.tn { 
        float: left; 
        width: ${ARG_TNSIZE}px; 
        height: ${ARG_TNSIZE}px; 
        vertical-align:text-top; 
        text-align: center; 
        margin: 4px; 
} 
div.tn a { 
        position: relative; 
        display: inline-block; 
        height: ${ARG_TNSIZE}px; 
} 
div.tn, div.big { 
        background-color: black; 
        border-width: 1px; 
        border-style: solid; 
        border-color: gray; 
        box-shadow: 1px 1px 2px #000; 
        padding: 1px; 
        border-radius: 3px; 
} 
div.tn:hover { 
        background-color: #222; 
} 
div.big { 
        display: inline-block; 
        width: ${ARG_BIGSIZE}px; 
} 
div.over { 
        width: ${ARG_BIGSIZE}px; 
        position: absolute; 
        top: 30px; 
        padding: 1px; 
} 
div.over a.left, div.over a.right { 
        display: block; 
        /* shell fuck of: missing CTLARI (shouldn't happen) - WTF?! */ 
        width: $(($ARG_BIGSIZE / 2))px; 
        position: relative; 
        top: 1px; 
        left: 1px; 
        background-repeat: no-repeat; 
} 
div.over a.left:hover { 
        background-position: 5% center; 
        background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAwC\ 
AYAAADtoXHnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAh9JREFUeNrE2L1Lw0A\ 
UAHATSivSZii0ldpBnMU6SgYJpQUJDlk7dLV+LTqIiIv4B7kLolBKQRA6GLqUDMEhqKAlhUIR4125SHo0b\ 
XJ51x68pDSX+3G5I/dyguM4S/MuMfeHIAiQ7Yo+//+OocAYPm+jWEXxg8JC8erCgvt4AXrqgkkUJRRZ6jq\ 
G71EMRcAeil6wWq2uGYZx1ul0jjRNy5Jey6PauKcRJ5NIhklCoaE4QODNYDCwHVJ6vd5HIpE4xNdQxKOiM\ 
0G3FIvFc4Imo6CBQV3XXwioje5jREOBkiQdE3SLFWUFFXJfaJQVLP2DIWdvFDA+9pYKiMKBAVFYMAAKD85\ 
A+YBTUH6gD8oXnIDyB31QviCFzgekUPxYVe4ghW7ixhRFueQKUmgZN9hut1s0aNv2V6FQOAUBqRvT+IAaX\ 
6crWZb1hsqQJFfPkPnpJz6YpmnQlXK5XD6TycRIcrUDib7jQ71ev+v3+9/eSqlUKt1qtU4IvIFid2x9jDC\ 
muJE9PG6qql7jcaTHttvt6gh2J1MZYva6ees+d9jnjcQXnoDyh31WGb7wlPWUHzwjc+ADB8iR4OGA2SAsH\ 
CLvhYNDZvgwMMO3THSY8auNBS6xfrVFhZUoaGjYk+qA7DkEgmu12i1Bs1C7K1NhvLviecTLEOhEuFKpXDW\ 
bzcdGo/Egy/KFZzKJPHbMVsiEyVPXTRRPeMdMWMQuqLi0gPInwACOBcZx3lRFMwAAAABJRU5ErkJggg=="); 
} 
div.over a.right:hover { 
        background-position: 95% center; 
        background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAwC\ 
AYAAADtoXHnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAiJJREFUeNrE2D1Lw0A\ 
YAOAmlNbBdii0FVM6OEu7SgcJpRUJDlk7dE21uuggIi7iD/IX+AGlFAXBDqVLyVCCBBW0JFhwMN7JHRxnY\ 
5PcnX3hhSM58nB3+Xhzkud5sf8OiWjLPn2+eGF4gHEChLkOcgUdt0E+isAlhCVAbiGQjGeQ1yBdHjAeKZ7\ 
SCgR1Xc8Nh8M90zQPG42GAo7lQFZBLhOzwSXgKI1kMrk7mUxePBTT6dQB8Dk8B1IHmUbTLrOMFI8WjsIol\ 
8tHHhW8YRKV0QWNwWDwIBKm0RK8aDqdbouEaRReQBUNkygJV0XCNBojnldh8CxUOOyHCoX/QoXB81AhcBC\ 
UOxwU5QqHQbnBYVFWODLKDEdFo8IanGYWNBSsquoJgkus6C+4UCgcOI7zRsP9fv8OoTWM8qh57mHlaFnWp\ 
23bFn1SUZQiambm1bphYgMWddlsNp7P51fpk+Px2ETNV1YUf383Qa5BsNfr7adSqQzZyXXd91ardUmUs8x\ 
rWYNrBcD2aDQa0GsJ11fTtDO0ntssd28UcAfXzSxvpLBg5DcSKyhH/cowgVG+p8xg2MqBCximRuIGBq0Gu\ 
YJB6l7u4LwKXwjo9y8jFPT7a6uKBGehqmiQRhO45BAJ0ijcQTGazeaFSJBGl/DUkrsrvMFZa/pzE1UqleN\ 
Op3PV7XZv6vX6KU+QRMkdM3gzFal+TyBvQX7w3DGTFrELKscWEN8CDADBm8pgcciwqgAAAABJRU5ErkJgg\ 
g==");  
} 
div.big a { 
        position: relative; 
        display: inline-block; 
        width: ${ARG_BIGSIZE}px; 
} 
div.box { 
        text-align: center; 
        width: ${ARG_BIGSIZE}px; 
        margin: auto; 
} 
div.box div.d { 
        width: ${ARG_BIGSIZE}px; 
        padding: 5px; 
        text-align: center; 
} 
div.box div.i { 
        width: ${ARG_BIGSIZE}px; 
        font-size: 90%; 
        height: 25px; 
        line-height: 25px; 
        position: relative; 
        left: 4px; 
} 
body > div.c { 
        text-align: center; 
        font-size: 90%; 
        height: 25px; 
        line-height: 25px; 
        position: relative; 
        margin: 4px; 
} 
a img { 
        border-width: 0; 
} 
a { 
} 
div.nav { 
        width: ${ARG_BIGSIZE}px; 
        height: 20px; 
} 
div.nav a { 
        color: #FFF; 
        text-decoration: none; 
} 
div.nav a:hover { 
        text-decoration: underline; 
} 
div.nav div.top { 
        position: absolute; 
        text-align: center; 
        width: $(($ARG_BIGSIZE - 100))px; 
        margin: 0 50px; 
} 
.left { 
        float: left; 
} 
.right { 
        float: right; 
} 
.clear { 
        clear: both; 
} 
                --> 
                </style> 
        </head> 
<body> 
HTML 
} 
 
# 
# html_footer() 
# 
html_footer() 
{ 
        cat <<HTML 
</body></html> 
HTML 
} 
 
# 
# html_tn() 
# 
html_tn() 
{ 
        tn=$1 
        link=$2 
 
        info=$($BIN_IMGINFO -f $tn) 
        width=$(echo $info | awk '{print $3}') 
        height=$(echo $info | awk '{print $4}') 
        top=$(($(($ARG_TNSIZE - $height)) / 2)) 
 
        cat <<HTML 
<div class="tn"> 
        <a href="$link" style="top:${top}px"> 
                <img alt="$tn" width="$width" height="$height" src="$tn" /> 
        </a> 
</div> 
HTML 
} 
 
# 
# html_img() 
# 
html_img() 
{ 
        orig=$1 
        img=$2 
        link=$3 
        linkb=$4 
        linkn=$5 
 
        info=$($BIN_IMGINFO -f $img) 
        width=$(echo $info | awk '{print $3}') 
        height=$(echo $info | awk '{print $4}') 
 
        desc=$(get_exif_desc $orig) 
        if [ "$desc" != "" ] 
         then          then
                desc="<div class='d'>$desc</div>"                ARG_DIR="$arg"
                 break
         fi          fi
           test $arg = -d && is_dir=1
   done
   
        if [ "$linkb" != "" ]echo $ARG_DIR
        then 
                hlinkb="<a href='$linkb'>zurück</a>" 
                olinkb="<a class='left' style='height:${height}px' href='$linkb'></a>" 
        fi 
   
        if [ "$linkn" != "" ]# load save args
        thenif [ -f "$ARG_DIR/$ARGFILE" ]
                hlinkn="<a href="$linkn">weiter</a>"then
                olinkn="<a class='right' style='height:${height}px' href='$linkn'></a>"        echo "load save settings"
        fi        . "$ARG_DIR/$ARGFILE"
 fi
   
         cat <<HTML  
 <div class="box">  
         <div class="nav">  
                 <div class="top"><a href="$link">Index</a></div>  
                 <div class="left">$hlinkb</div>  
                 <div class="right">$hlinkn</div>  
         </div>  
         <div class="big">  
                 <img alt="$img" width="$width" height="$height" src="$img" />  
         </div>  
         $desc  
         <div class="i">  
                 <div class="left">$(get_exif_info $orig)</div>  
                 <div class="right">$ARG_TITLE $ARG_COPYRIGHT</div>  
         </div>  
         <div class="over" style='height:${height}px'>  
                 $olinkb  
                 $olinkn  
         </div>  
 </div>  
 HTML  
 }  
   
 #  
 # err  
 #  
 err()  
 {  
         echo "$1" >&2  
         exit 1  
 }  
   
 #  
 # mysendmail()  
 #  
 mysendmail()  
 {  
         subject=$1  
         (  
                 cat <<MAIL  
 From: $ARG_MAILFROM  
 To: $ARG_MAILTO  
 Subject: $subject  
 Content-Type: text/plain; charset=iso-8859-1  
 X-Mailer: $VERSION  
   
 $(cat)  
 MAIL  
         ) | $BIN_SENDMAIL -t  
 }  
   
 #  
 # get_exif_desc()  
 #  
 get_exif_desc()  
 {  
         img=$1  
         $BIN_EXIF --ifd=0 --tag=0x010e -m $img 2> /dev/null | iconv -t ISO-8859-1 -f UTF-8 | while read line  
         do  
                 echo "$line<br />"  
         done  
 }  
   
 #  
 # get_exif_value()  
 #  
 get_exif_value()  
 {  
         img=$1  
         hex=$2  
         $BIN_EXIFTRAN -d $img | grep $hex | sed -E 's/^.{45}//'  
 }  
   
 #  
 # get_exif_info()  
 #  
 get_exif_info()  
 {  
         img=$1  
         exifinfo=  
         for exif in $ARG_EXIF  
         do  
                 if echo $exif | grep -q -E '0x[[:alnum:]]{4}'  
                 then  
                         exifinfo="$exifinfo$(get_exif_value $img $exif) "  
                 else  
                         exifinfo="$exifinfo$exif "  
                 fi  
         done  
         echo $exifinfo | sed -e 's/ mm /mm /' -e 's/ sec./s/' -e 's/ ISO / ISO/'  
 }  
   
 # parse args  # parse args
 while [ "$1" != "" ]  while [ "$1" != "" ]
 do  do
Line 522  do Line 154  do
         esac          esac
 done  done
   
   # go to gallery directory
   MY=$(get_my_path)
   cd "$ARG_DIR" || exit 1
   
 # parese info file  # parese info file
 if [ "$ARG_INFOFILE" != "" ]  if [ "$ARG_INFOFILE" != "" ]
 then  then
         test -f $ARG_INFOFILE || err "info file not found \`\`$ARG_INFOFILE''"          test -f $ARG_INFOFILE || err "info file not found \`\`$ARG_INFOFILE''"
         for n in TITLE COPYRIGHT INDEX FILETYPES TNSIZE TNQALITY BIGSIZE \          for n in TITLE COPYRIGHT INDEX FILETYPES TNSIZE TNQALITY BIGSIZE \
                BIGQALITY MAILTO MAILFROM URL EXIF                BIGQALITY MAILTO MAILFROM URL EXIF INDEXIMG
         do          do
                 v=$(make -f $ARG_INFOFILE -V$n)                  v=$(make -f $ARG_INFOFILE -V$n)
                 test "$v" = "" && continue                  test "$v" = "" && continue
Line 535  then Line 171  then
         done              done    
 fi  fi
   
# go to gallery directory#paras from iso to utf-8
MY=$(get_my_path)for n in $(set | awk -F= '{print $1}')
cd "$ARG_DIR" || exit 1do
         echo "$n" | grep -q '^ARG_' || continue
         eval "$n=\"\$(echo \"\$$n\" | iconv -f ISO-8859-1 -t UTF-8)\""
 done
   
 # fix url  # fix url
 if [ "$ARG_URL" != "" ]  if [ "$ARG_URL" != "" ]
Line 554  then Line 193  then
                 match="$match *.$(echo $type | tr '[:lower:]' '[:upper:]')"                  match="$match *.$(echo $type | tr '[:lower:]' '[:upper:]')"
                 match="$match *.$(echo $type | tr '[:upper:]' '[:lower:]')"                  match="$match *.$(echo $type | tr '[:upper:]' '[:lower:]')"
         done          done
        ARG_FILES=$(cd $ARG_DIR && ls $match 2>/dev/null)        FLIST=$(ls $match 2>/dev/null)
 else
         FLIST="$ARG_FILES"
 fi  fi
   
 # Filter big and thumbnails  # Filter big and thumbnails
 echo -n "find images"  echo -n "find images"
FLIST=FLISTF=
for file in $ARG_FILESfor file in $FLIST
 do  do
         test $(echo $file | grep -E '\.(tn|big)\.jpg$') && continue          test $(echo $file | grep -E '\.(tn|big)\.jpg$') && continue
        FLIST="$FLIST $file"        FLISTF="$FLISTF $file"
         echo -n " $file"          echo -n " $file"
 done  done
echo echo
 FLIST="$FLISTF"
   
 test $(echo $FLIST | wc -w) -eq 0 && err "error: no image found in \`\`$ARG_DIR''"  test $(echo $FLIST | wc -w) -eq 0 && err "error: no image found in \`\`$ARG_DIR''"
   
   # use exif createtime to order images
   FLIST=$(
           (
                   for file in $FLIST
                   do
                           echo "$(get_exif_ts $file) $file"
                   done
           ) | sort -n | awk '{print $2}'
   )
   
   # if no master image, we use the first one
   test "$ARG_INDEXIMG" = "" && ARG_INDEXIMG=$(echo $FLIST | awk '{print $1}')
   
 # find new and to update images  # find new and to update images
 FLIST_NEW=  FLIST_NEW=
 FLIST_UPDATE=  FLIST_UPDATE=
Line 596  echo "tns: $targets" >> $MKAKEFILE Line 251  echo "tns: $targets" >> $MKAKEFILE
 FLIST_UPDATE=$(make -f $MKAKEFILE)  FLIST_UPDATE=$(make -f $MKAKEFILE)
 rm $MKAKEFILE  rm $MKAKEFILE
   
   # save args
   test -f $ARGFILE && rm $ARGFILE
   echo "save settings"
   set | while read n
   do
           echo "$n" | grep -q '^ARG_' || continue
           echo "$n" >> $ARGFILE
   done
   
 # update and no new and update images found  # update and no new and update images found
 if [ $ARG_UPDATE -eq 1 -a "$FLIST_NEW" = "" -a "$FLIST_UPDATE" = "" ]  if [ $ARG_UPDATE -eq 1 -a "$FLIST_NEW" = "" -a "$FLIST_UPDATE" = "" ]
 then  then
Line 641  echo "tns: $targets" >> $MKAKEFILE Line 305  echo "tns: $targets" >> $MKAKEFILE
 make -f $MKAKEFILE  make -f $MKAKEFILE
 rm $MKAKEFILE  rm $MKAKEFILE
   
# create single html files# create html index
 index=""  index=""
   for file in $FLIST
   do
           tn="${file}.tn.jpg"
           imglink="${file}.html"
           index="$index $(html_tn $tn $imglink)"
   done
   echo create html index
   (
           html_header
           echo $index
           echo "<div class='clear'></div>"
           echo "<div class='c'>$ARG_TITLE $ARG_COPYRIGHT</div>"
           html_footer
   ) > $ARG_INDEX
   
   # create single html files
 i=0  i=0
   all=$(echo $FLIST | wc -w)
 echo -n "create single html files "  echo -n "create single html files "
 for file in $FLIST  for file in $FLIST
 do  do
Line 651  do Line 332  do
         i=$(($i + 1))          i=$(($i + 1))
         j=$(($i + 1))          j=$(($i + 1))
   
        tn="${file}.tn.jpg"        # is update mod and no new images founded
         if [ $ARG_UPDATE -eq 1 -a "$FLIST_NEW" = "" ]
         then
                 is_in_list "$FLIST_UPDATE" "$file" || continue
         fi
 
         big="${file}.big.jpg"          big="${file}.big.jpg"
         imglink="${file}.html"          imglink="${file}.html"
   
Line 663  do Line 349  do
         test "$linkn" != "" && linkn="$linkn.html"          test "$linkn" != "" && linkn="$linkn.html"
   
         echo -n .          echo -n .
         index="$index $(html_tn $tn $imglink)"  
         (          (
                 html_header                  html_header
                html_img $file $big $ARG_INDEX "$linkb" "$linkn"                html_img $file $i $all $big $ARG_INDEX "$linkb" "$linkn"
                 html_footer                  html_footer
         ) > $imglink          ) > $imglink
 done  done
 echo  echo
   
# create html index# .htaccess
echo create html indexif [ -f .htaccess ]
(then
        html_header        grep -q 'AddCharset UTF-8 .html' < .htaccess || echo "AddCharset UTF-8 .html" >> .htaccess
        echo $indexelse
        echo "<div class='clear'></div>"        echo "AddCharset UTF-8 .html" > .htaccess
        echo "<div class='c'>$ARG_TITLE $ARG_COPYRIGHT</div>"fi
        html_footer 
) > $ARG_INDEX 
 
   
 test "$ARG_MAILTO" = "" && exit 0  test "$ARG_MAILTO" = "" && exit 0
   

Removed from v.1.9  
changed lines
  Added in v.1.18