山田邦博です。

Mkphothhtml Version 2.3(バージョン アップ)の投稿です。

  ディジタルカメラ(Digital Camera)で多量に撮った写真を簡単に整理し、
Netscape や Mozilla 等の一般的なブラウザ(Web browser) で見れるようにする
ものです。 Network photo album としての機能も持っています。
Unix ユーザ(Unix user)向けです。

変更内容は、画素数の異なる画像を規格化出来るようにした事、および、タイ
ムゾーンを設定できるようにした事です。 
これにより、1/1 サイズの画像を全て同一にできます。また、海外旅行等にお
ける画像の日時表示を現地時間にできます。 

getphotofromusb というおまけのプログラムを追加しました。 カメラを USB
接続して、そこから画像を取り込みます。

-...-

Mkphotohtml Ver.2.3 の全てのファイルは

        ftp://ftp.tksa.gr.jp/king/image/Mkphotohtml_2.3.tgz

にあります。
これには、インストーラ、小さな関連プログラム(便利グッズ)、設定例、細か
いドキュメント等が含まれています。

最新の Mkphotohtml (ドキュメントを含む)については

       http://www.tksa.gr.jp/king/Software/Mkphotohtml/index.html

を参照して下さい。
そこに実例(http://www.tksa.gr.jp/cats/photo.html)も示しておきました。

-...-

本投稿は 2部に分けます。
        DOC     (diff)
        BIN     (diff+shar)(今回投稿分)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

##### (BEGIN) cut here for binaries #####
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2006-09-08 16:35 JST by <king@owlin>.
# Source directory was `/home/king/tmp'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#  29629 -rw-r----- mkphotohtml.bin.diff
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
  shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
  shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
  shar_touch='touch -am $3$4$5$6$2 "$8"'
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh01596; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= mkphotohtml.bin.diff ==============
if test -f 'mkphotohtml.bin.diff' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'mkphotohtml.bin.diff' '(file already exists)'
else
  $echo 'x -' extracting 'mkphotohtml.bin.diff' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'mkphotohtml.bin.diff' &&
diff -Nru Mkphotohtml_2.2/bin/getphotofromcard Mkphotohtml_2.3/bin/getphotofromcard
--- Mkphotohtml_2.2/bin/getphotofromcard        2003-11-11 15:26:25.000000000 +0900
+++ Mkphotohtml_2.3/bin/getphotofromcard        2006-09-03 13:23:12.000000000 +0900
@@ -82,8 +82,8 @@
X # File path of the image files on the Card (maybe PCMCIA)
X #
X CARD="/card"               # PCMCIA Card mounted on $CARD
-CHECKDIR=$CARD/dcim        # check dir for the image card (Canon)
-IMAGEFILES="$CHECKDIR/*canon/img_*.jpg"    # Image files  (Canon)
+CHECKDIR=$CARD/dcim        # check dir for the image card
+IMAGEFILES="$CHECKDIR/*/*.jpg"    # Image files
X 
X # Eject the card after read all image files.
X #
@@ -172,7 +172,7 @@
X     if $DEBUG; then echo "## allowed=($allowed) NO_ALLOW=($NO_ALLOW)"; fi
X fi
X 
-echo "## ($HOME/etc/$MKPHOTOHTML/$CONF) ##"
+if $DEBUG; then echo "## ($HOME/etc/$MKPHOTOHTML/$CONF) ##"; fi
X if [ -r $HOME/etc/$MKPHOTOHTML/$CONF ]; then
X     if $DEBUG; then echo "## User configuration file is read."; fi
X     source $HOME/etc/$MKPHOTOHTML/$CONF     # User configuration file
@@ -229,7 +229,7 @@
X     chmod $FPERMISSION $THEME_DIR/$RAW/$tname
X done
X 
-if [ $allowed != "Yes"  -a  "$NO_ALLOW" = "Warn"]; then
+if [ $allowed != "Yes"  -a  "$NO_ALLOW" = "Warn" ]; then
X     echo "You might be required passwd of root when eject the CARD." >&2
X fi
X if [ "$EJECT" == "Yes" ]; then
diff -Nru Mkphotohtml_2.2/bin/getphotofromusb Mkphotohtml_2.3/bin/getphotofromusb
--- Mkphotohtml_2.2/bin/getphotofromusb 1970-01-01 09:00:00.000000000 +0900
+++ Mkphotohtml_2.3/bin/getphotofromusb 2006-09-07 00:32:00.000000000 +0900
@@ -0,0 +1,252 @@
+#!/bin/bash
+
+# getphotofromusb : get photos from a usb and setup html file.
+
+# Usage:
+#      getphotofromusb [options] [theme_dir]
+#
+# Options.
+#      -D : Debug
+#      -h : help
+#      -m : make new directory theme_dir (and theme_dir/$RAW)
+#      -p : make html for parent Photos
+#              same as    mkphotohtml -r theme_dir/..
+#              default :  mkphotohtml theme_dir
+#      -r : sub-directory name for raw image.
+#              default : ":raw"
+#      -u umask : umask (default 022)
+#
+# theme_dir:
+#      default is /home/www1/$USER/Photos/incoming/
+#
+# Note:
+#   /etc/fstab : (example)
+#        /dev/sda1   /.usb   msdos   noauto,user,ro   0 0
+#
+
+# Author:
+#      YAMADA Kunihiro <king@tksa.gr.jp>
+#
+# Copyright policy:
+#      GNU GPL Ver.2
+#
+
+# History:
+#   30 Jul.2006   coded. (modified getphotofromcard)
+#
+
+
+#######################################
+### Please configure for your needs ###
+#######################################
+
+MKPHOTOHTML="mkphotohtml"
+ALLOWED_USER="/etc/$MKPHOTOHTML/allowed-user"    # Allowed users listed here
+CONF="getphotofromusb.conf"
+
+###
+### Following configuration can be overriden by
+#      System configuration file : /etc/$MKPHOTOHTML/$CONF
+
+# Action when invoked by non-allowed user.
+# 
+NO_ALLOW="Ignore"                    # "Ignore" or "Prohibitted"
+#NO_ALLOW="Prohibitted"                      # "Ignore" or "Prohibitted"
+
+###
+### Following configurations can be overriden by
+#         System configuration file : /etc/$MKPHOTOHTML/$CONF
+#      or User configuration file   : $HOME/etc/$MKPHOTOHTML/$CONF
+
+# Permission
+#
+UMASK=022
+FPERMISSION=0644           # File permission for raw images
+
+# Theme theme directory and it's subdirectory for raw image files.
+#
+THEME_DIR="/home/www1/$USER/Photos/incoming" # Theme directory
+RAW=":raw"                 # subdirectory for raw image files
+
+# File path of the image files on the Usb (maybe PCMCIA)
+#
+USB="/.usb"               # Usb memory mounted on $USB
+CHECKDIR=$USB/dcim        # check dir for the image
+IMAGEFILES="$CHECKDIR/*/*.jpg"    # Image files
+
+# Umount the usb after read all image files.
+#
+UMOUNT="Yes"                 # "Yes" or "No"
+
+#############################
+###  End of Configuration ###
+#############################
+
+
+set -e
+PNAME=$(basename $0)
+
+DEBUG=false
+MAKENEWDIR=no
+PARENTPHOTO=no
+
+while getopts ":Dhmpr:u:" optn; do
+    case $optn in
+       m ) MAKENEWDIR=Yes   ;;
+       h ) HELP=Yes         ;;
+       p ) PARENTPHOTO=Yes  ;;
+       r ) RAW="$OPTARG"    ;;
+       u ) UMASK="$OPTARG"  ;;
+       D ) DEBUG=true       ;;
+       * ) echo <<EOF >&2
+usage: $PNAME [-m] [-p] [-r raw_image_sub_dir] [-u umask] [theme_dir]
+EOF
+           exit 1           ;;
+    esac
+done
+
+if [ "$HELP" = "Yes" ]; then
+    cat <<EOF
+Usage: $PNAME [options] [theme_dir]
+    options:
+       -D : Debug
+       -h : help
+       -m : make new directory theme_dir (and theme_dir/$RAW)
+       -p : make html for parent Photos
+               same as    mkphotohtml -r theme_dir/..
+               default :  mkphotohtml $THEME_DIR
+       -r : sub-directory name for raw image.
+               default : ":raw"
+       -u umask : umask (default 022)
+    theme_dir:
+       default is $THEME_DIR/
+EOF
+    exit 0
+fi
+
+shift $((OPTIND - 1))
+if [ $# -gt 1 ]; then
+    echo "$PNAME: Number of theme_dirs should not be 2 or more" >&2
+    exit 1
+fi
+if [ $# -eq 1 ]; then
+    THEME_DIR=$1
+fi
+if $DEBUG; then echo "## THEME_DIR=\"$THEME_DIR\""; fi
+if $DEBUG; then echo "## IMAGEFILES=$IMAGEFILES"; fi
+
+if [ -r /etc/$MKPHOTOHTML/$CONF ]; then
+    if $DEBUG; then echo "## System configuration file is read."; fi
+    source /etc/$MKPHOTOHTML/$CONF          # System configuration file
+else
+    if $DEBUG; then echo "## System configuration file is not found."; fi
+fi
+
+umask $UMASK
+allowed=0
+if [ -r $ALLOWED_USER ]; then
+    while read u dmy; do
+       if [ "$u" = "$USER" ]; then
+           allowed=Yes
+       fi
+    done < $ALLOWED_USER
+else
+    if $DEBUG; then echo "## No \"$ALLOWED_USER\""; fi
+fi
+if [ $allowed != "Yes" -a "$NO_ALLOW" != "Ignore" ]
+then
+    echo "You are not allowed to use this command, sorry." >&2
+    exit 1;
+else
+    if $DEBUG; then echo "## allowed=($allowed) NO_ALLOW=($NO_ALLOW)"; fi
+fi
+
+# echo "## ($HOME/etc/$MKPHOTOHTML/$CONF) ##"
+if [ -r $HOME/etc/$MKPHOTOHTML/$CONF ]; then
+    if $DEBUG; then echo "## User configuration file is read."; fi
+    source $HOME/etc/$MKPHOTOHTML/$CONF     # User configuration file
+else
+    if $DEBUG; then echo "## User configuration file is not found."; fi
+fi
+
+if [ ! -d $THEME_DIR ]; then
+    if [ "$MAKENEWDIR" = "Yes" ]; then
+       YN="Y"
+    else
+       echo "make directory $THEME_DIR : (y/N)?" >&2
+       read YN
+    fi
+    if [ "$YN" = "Y"  -o  "$YN" = "y" ]; then
+       if ! mkdir -p $THEME_DIR/$RAW; then
+           echo "basename($0): Cannot mkdir -p $THEME_DIR/$RAW" >&2
+           exit 1
+       fi
+       echo "$THEME_DIR is created now" >&2
+    else
+       echo "aborted now" >&2
+       exit 2
+    fi
+fi
+if [ ! -d $THEME_DIR/$RAW ]; then
+    if ! mkdir $THEME_DIR/$RAW; then
+       echo "basename($0): Cannot mkdir $THEME_DIR/$RAW" >&2
+       exit 1
+    fi
+fi
+
+if ! df | grep -q " $USB"; then
+    if ! mount $USB; then
+       echo "Connect the usb and press Return key." >&2
+       read;
+       if ! mount $USB; then
+           echo "Cannot mount $USB." >&2
+           exit 2;
+       fi
+    fi
+    if  ! df | grep -q " $USB"; then
+       echo "Cannot mount $USB." >&2
+       exit 2;
+    fi
+fi
+
+if [ ! -d $CHECKDIR ]; then
+    echo "No Image usb. (Missing $CHECKDIR)" >&2
+    exit 3
+fi
+
+if echo $IMAGEFILES | grep -q "*"; then
+    echo "No image file found on the usb." >&2
+    exit 4
+fi
+for f in $IMAGEFILES; do
+    fname=$(basename $f)
+    tname=${fname%.*}.jpeg       # change extention to ".jpeg" for the theme
+    if ! cp -p $f $THEME_DIR/$RAW/$tname; then
+       echo "Cannot copy Image file($f) from the usb to $THEME_DIR/$RAW/$tname" >&2
+       exit 5
+    fi
+    chmod $FPERMISSION $THEME_DIR/$RAW/$tname
+done
+
+if [ "$UMOUNT" == "Yes" ]; then
+    if umount $USB; then
+       echo "You may disconnect the usb now." >&2
+    else
+       echo "Umount ($USB) error for the usb." >&2
+       echo "But proceed." >&2
+    fi
+fi
+
+echo "Wait a moment please for making photo.html" >&2
+if [ "$PARENTPHOTO" = "Yes" ]; then
+    cd $THEME_DIR/..
+    mkphotohtml -r
+else
+    cd $THEME_DIR
+    mkphotohtml
+fi
+
+if [ -d $USB/$CHECKDIR ]; then
+    echo "Please umount $USB and disconnect the usb" >&2
+fi
+exit 0
diff -Nru Mkphotohtml_2.2/bin/install.sh Mkphotohtml_2.3/bin/install.sh
--- Mkphotohtml_2.2/bin/install.sh      2003-11-11 15:23:34.000000000 +0900
+++ Mkphotohtml_2.3/bin/install.sh      2006-09-03 13:03:48.000000000 +0900
@@ -37,7 +37,7 @@
X fi
X 
X ### List of files to be installed or uninstalled ###
-BIN="mkphotohtml image-rotate getphotofromcard is-utf8"
+BIN="mkphotohtml image-rotate getphotofromcard getphotofromusb is-utf8"
X ETC="allowed-user.sample getphotofromcard.conf.sample message.english message.japanese option.sample"
X DOC="BUGS.jp.txt Change.log Format.txt GPL-2 INSTALL.jp.txt MUMBLE.jp.txt README.jp.txt"
X 
diff -Nru Mkphotohtml_2.2/bin/mkphotohtml Mkphotohtml_2.3/bin/mkphotohtml
--- Mkphotohtml_2.2/bin/mkphotohtml     2004-10-12 14:05:17.000000000 +0900
+++ Mkphotohtml_2.3/bin/mkphotohtml     2006-09-08 15:54:34.000000000 +0900
@@ -24,12 +24,14 @@
X #       -l lang : Set laguage to lang for messages of photo.html
X #       -m mailaddress :
X #            Mail address like as 'yourid@your.domain'
+#       -n size : Normalize size of base of images.
X #       -o : Default theme options for Contents.conf:
X #              There are many sub options.
X #              The format is "Sub-Option=value,...."
X #              Type "mkphothtml -h: for detail theme options,
X #              or read README.jp.txt for more detail
X #       -p string : add string as prolog to photo.html
+#       -q : Quiet
X #       -r : Recursive
X #       -s : Suppress start page infomation in HTML header
X #       -t url :
@@ -38,6 +40,7 @@
X #            Full name of user like as "Firstname Lastname"
X #       -v : Verbose messages
X #       -w : check web page
+#       -z timezone : Time Zone (Same as -o Time-Zone=continet/country)
X #
X # Directories:
X #       Directory list of the themes.  (Default : current directory(.))
@@ -75,6 +78,7 @@
X #   11 Nov.2003   Ver.2.0 : Released
X #    5 Mar.2004   Ver.2.1 : Released
X #   12 Oct.2004   Ver.2.2 : Released
+#    8 Sep.2006   Ver.2.3 : Released
X #
X 
X no lib qw(:ALL .);
@@ -89,10 +93,11 @@
X use LWP::Simple;
X use IPC::Open2;
X use Net::Domain qw(hostfqdn hostdomain);
-use Image::Size 'html_imgsize';
+use Image::Size 'html_imgsize','imgsize';
X use Unicode::MapUTF8 qw(to_utf8 utf8_supported_charset);
X use vars qw($opt_b $opt_c $opt_C $opt_d $opt_D $opt_e $opt_f $opt_h $opt_l
-           $opt_m $opt_o $opt_p $opt_r $opt_s $opt_t $opt_u $opt_v $opt_w);
+           $opt_m $opt_n $opt_o $opt_p $opt_q $opt_r $opt_s $opt_t $opt_u
+           $opt_v $opt_w $opt_z);
X 
X die "$0 : \"Root user or group\" is prohibitted, sorry.\n"
X   if $< == 0 or $> == 0 or $( == 0 or $) == 0;   # uid,euid,gid,egid : root?
@@ -114,10 +119,10 @@
X ## program path ##
X my $DJPEG = "/usr/bin/djpeg";         # decompress a JPEG file to an image file
X my $CJPEG = "/usr/bin/cjpeg";         # compress an image file to a JPEG file
-my $JPEGTOPNM = "/usr/bin/jpegtopnm -quiet";
-                                      # convert JFIF file to portable pixmap
+my $JPEGTOPNM = "/usr/bin/jpegtopnm"; # convert JFIF file to portable pixmap
X my $PNMSCALE  = "/usr/bin/pnmscale";  # scale a PNM image
X my $PNMTOJPEG = "/usr/bin/pnmtojpeg"; # convert PNM image to a JFIF image
+my $DATE_CMD  = '/bin/date -d $date'; # date command
X 
X ## Limit for web
X my $MAXWEBDOCLENGTH = 1000000;        # Maximum allowed size for web page
@@ -138,6 +143,7 @@
X $::opt_config = "Non";              # , First or Last
X $::opt_mail   = '$userid@$domain';  # your mail address
X $::opt_uname  = '$passwd';          # your name like as "First Middle Last"
+$::opt_normsz = 1200;             # Normalize size of image(1/1) (shorter base)
X $::opt_scale  = "(1/1=:raw)(1/2=:shrink)(1/4=:shrink)(1/8=:shrink)";
X               # Scale and Directory name for raw and shrinked pictures
X $::opt_size   = "(Normal=1/2)(Header=1/4)(Index=1/8)";
@@ -146,7 +152,7 @@
X $::opt_start  = "Yes";              # or No  (start page added in HTML header)
X $::opt_top    = "/index.html";      # link to Top page or URL
X $::opt_ckweb  = "No";               # or Yes (Check Web theme page)
-$::opt_refer  = "Allowed";           # or Denied (refer for photo album)
+$::opt_refer  = "Allowed";          # or Denied (refer for photo album)
X $::opt_prolog = '$copyright: $uname <$Mail>';
X                      # Any string for prolog clause
X                         # $copyrigh := $html_message{$::opt_lang}->{Copyright}
@@ -155,9 +161,12 @@
X $::opt_epilog = '';  # Any string for epilog clause like as prolog clause
X #$::opt_epilog = '$copyright: $uname <$Mail>';
X $::opt_ps = 'This was created by Mkphotohtml. Reference/Link to this webpage is $refer.';
-$::opt_date   = '';     # filter from UTF to Local time with locale
-#$::opt_date   = 'LANG=ja_JP.UTF-8 /bin/date -d $date';    # for Japanese
-#$::opt_date   = 'LANG=C /bin/date -d $date';              # for English
+$::opt_tz    = '';   # Time Zone (overridden environment TZ if specified)
+#
+## filter from UTF to Local time with locale
+$::opt_date  = '';                              # Time zone is not displayed
+#$::opt_date = "LANG=C $DATE_CMD";              # for English
+#$::opt_date = "LANG=ja_JP.UTF-8 $DATE_CMD";    # for Japanese
X 
X 
X #############################
@@ -166,7 +175,7 @@
X 
X 
X ### Constants ###
-my $VERSION = "2.2";
+my $VERSION = "2.3";
X my $WEBINFO = "http://www.tksa.gr.jp/king/Software/Mkphothtml/";
X 
X my $PFIRST = "[-_]?(?:First|1st|Fir)";
@@ -190,13 +199,14 @@
X my %html_message;     # messages for html with multi lingual.
X                       #    $html_message{$::opt_lang}->{Item}
X 
-my ($CLEAN,$DEBUG,$FORCEUPDATE,$HELP,$RECURSIVE,$VERBOSE);
+my ($CLEAN,$DEBUG,$FORCEUPDATE,$HELP,$QUIET,$RECURSIVE,$VERBOSE);
X 
-getopts('bcC:d:De:fhl:m:o:p::rst:u:vw');
+getopts('bcC:d:De:fhl:m:n:o:p:qrst:u:vwz:');
X $CLEAN       = $opt_c;
X $DEBUG       = $opt_D;
X $FORCEUPDATE = $opt_f;
X $HELP        = $opt_h;
+$QUIET       = $opt_q;
X $RECURSIVE   = $opt_r;
X $VERBOSE     = $opt_v;
X 
@@ -236,12 +246,19 @@
X     push @langs,$lang unless grep($_ eq $lang, @langs);
X   }
X   my $langs = join(',', sort(@langs));
+  my $tz = '';
+  if (defined $ENV{TZ}) {
+    $tz = $ENV{TZ};
+  } elsif (-r "/etc/timezone") {
+    $tz = qx(cat /etc/timezone);
+    chomp $tz;
+  }
X 
X   print <<EOF;
X 
X This is Mkphotohtml version $VERSION
X 
-Copyright 2001-2004, YAMADA Kunihiro <king\@tksa.gr.jp>
+Copyright 2001-2006, YAMADA Kunihiro <king\@tksa.gr.jp>
X 
X You can get the latest version from
X \t$WEBINFO
@@ -254,23 +271,26 @@
X         (same as -o Back=Yes)
X    -c : Clean up bogus shrinked images
X    -C characterset :
-        Specify charset to characterset for Contents.conf
+        Specify Charset to characterset for Contents.conf
X         (same as -o Charset=characterset)
X    -d Date-Command :
X         Shell date command with options and parameter \$date.
X         (same as -o Date-Command=shell-command-string)
X    -D : Debug
X    -e string :
-        add string as epilog to photo.html
+        add string as Epilog to photo.html
X    -f : Force update
X    -h : Help
X    -l lang :
-        Set laguage to lang for messages of photo.html
+        Set Laguage to lang for messages of photo.html
X         (same as -o Language=lang)
X    -m mailaddress :
X         Mail address like as 'yourid\@your.domain'
X         (same as -o Mail-Address=yourid\@your.domain)
-   -o : Default theme options for $CONFIG:
+   -n size :
+        Normalize image size(1/1). (Shorter base) (Derault : $::opt_normsz)
+        If size=0, nomalization is skipped.
+   -o : Default theme Options for $CONFIG:
X         Charset=characterset
X         Language=any-language       (Default : $::opt_lang)
X               Note: You can specify any language if you prepared a proper
@@ -281,6 +301,7 @@
X         Config=Non|First|Last       (Default : $::opt_config)
X         Mail-Address=yourid\@your.domain  (Default : $::opt_mail)
X         User-Name="FirstName LastName"   (Default : $::opt_uname)
+        Normalize-Image-Size=size   (Default : $::opt_normsz)
X         Scale-Directory=(scale1=directory1)(scale2=directory2)....
X                  (Scale and Directory name for raw and shrinked pictures)
X                  Default : $::opt_scale
@@ -295,9 +316,10 @@
X         Prologue=any-string   (Default : "$::opt_prolog")
X         Epilogue=any-string   (Default : "$::opt_epilog")
X         Postscript=any-string (Default : "$::opt_ps")
+        Time-Zone=continent/country      (Default : "$tz")
X         Date-Command=date-command-string (Default : "$::opt_date")
X    -p string :
-        add string as prolog to photo.html
+        add string as Prolog to photo.html
X    -r : Recursive
X    -s : Suppress start page infomation in HTML header
X         (Same as -o Start=No)
@@ -305,11 +327,12 @@
X         address or URL of Top page for start
X         (same as -o Top=url)
X    -u username :
-        Full name of user like as "Firstname Lastname"
+        Full name of User like as "Firstname Lastname"
X         (same as -o "User-Name=Firstname Lastname")
X    -v : Verbose messages
-   -w : check web page
+   -w : check Web page
X         (same as -o Check-Web=Yes)
+   -z timezone : Time Zone (Same as -o Time-Zone=continet/country)
X 
X Directories:
X         Directory list of the themes.  (Default : current directory(.))
@@ -352,12 +375,14 @@
X EOF
X }
X 
+set_option("sh","Normalize-Image-Size=$opt_n") if $opt_n;
X set_option("sh","Prolog=$opt_p") if $opt_p; # Add prolog clause to photo.html
X set_option("sh","Epilog=$opt_e") if $opt_e; # Add epilog clause to photo.html
X $::opt_start  = "No"      if $opt_s;     # Start page info. into HTML header
X $::opt_top    = $opt_t    if $opt_t;     # address or URL of Top page
X set_option("sh","User-Name=$opt_u") if $opt_u;     # User Name
X $::opt_ckweb  = "Yes"     if $opt_w;     # check web theme page
+set_option("sh","Time-Zone=$opt_z")    if $opt_z;  # Time Zone
X set_option("sh","Date-Command=$opt_d") if $opt_d;  # date command with options
X if ($opt_o) {                            # Option -o (from sh command)
X   foreach (split m/,/,$opt_o) {
@@ -552,7 +577,7 @@
X     $errmes = "Error at $from line $::ILN:";
X   }
X 
-  if (s/Sca(le)?([-_]?($PDIR)?)?\s*=\s*//io) {
+  if (s/^Sca(le)?([-_]?($PDIR)?)?\s*=\s*//io) {
X     s/\s+//g;
X     $::opt_scale = $_;
X     $::opt_size = "";           # option_size should be set later
@@ -599,7 +624,7 @@
X \t                 the one of scale of $v is "$cx".)
X EOF
X     }
-  } elsif (s/Size?([-_]?(of[-_]?)?Pic(ture)?)?\s*=\s*//i) {
+  } elsif (s/^Size?([-_]?(of[-_]?)?Pic(ture)?)?\s*=\s*//i) {
X     s/\s+//g;
X     my ($h,$i,$n);
X     while (s/^\(.+?\)//) {
@@ -638,6 +663,15 @@
X #    print "#",__LINE__,"# option_size='$::opt_size'\n" if $DEBUG;
X   } elsif ($only_scale_size) {      # truncate here if only scale size
X     return;
+  } elsif (s/^Nor(malize)?([-_]?Ima(ge)?)?([-_]?Size?)?\s*=\s*//io) {
+    s/\s+.*//;
+    $::opt_normsz = $_;
+    unless (/^\d*$/) {
+      die <<EOF;
+$errmes
+\t"Normalize-Image-Size=" should be integer number.
+EOF
+    }
X   } elsif (s/^(Lan(guage)?|Lang)\s*=\s*//i) {
X     $::opt_lang = "\L$_\E";
X     unless (exists $html_message{$_}) {
@@ -670,7 +704,7 @@
X \t                        or Image-First (Theme-Last)
X EOF
X     }
-  } elsif (s/$PIMAGE\s*=\s*//i) {
+  } elsif (s/^$PIMAGE\s*=\s*//i) {
X     if (/^Nor(mal)?$/i) {
X       $::opt_image = "Normal";
X     } elsif (/^Rev(erse)?$/i) {
@@ -681,7 +715,7 @@
X \t"Option: Image=" should be "Normal" or "Reverse"
X EOF
X     }
-  } elsif (s/($PTHEME|$PDIR)\s*=\s*//io) {
+  } elsif (s/^($PTHEME|$PDIR)\s*=\s*//io) {
X     if (/^Nor(mal)?$/i) {
X       $::opt_theme = "Normal";
X     } elsif (/^Rev(erse)?$/i) {
@@ -692,7 +726,7 @@
X \t"Option: Theme=" should be "Reverse" or "Normal"
X EOF
X     }
-  } elsif (s/Con(fig)?\s*=\s*//i) {
+  } elsif (s/^Con(fig)?\s*=\s*//i) {
X     if (/^Non$/i) {
X       $::opt_config = "Non";
X     } elsif (/^(First|1st|Fir)$/i) {
@@ -765,12 +799,15 @@
X \t"Option: Refer=" should be "Allowed" or "Denied".
X EOF
X     }
-  } elsif (s/^(Pro|Prolog|Prologue)?\s*=\s*//i) {
+  } elsif (s/^(Pro|Prolog|Prologue)\s*=\s*//i) {
X     $::opt_prolog = $_;
-  } elsif (s/^(Epi|Epilog|Epilogue)?\s*=\s*//i) {
+  } elsif (s/^(Epi|Epilog|Epilogue)\s*=\s*//i) {
X     $::opt_epilog = $_;
X   } elsif (s/^(Postscript|Post|Pos|PS)\s*=\s*//i) {
-    $::opt_ps =$_;
+    $::opt_ps = $_;
+  } elsif (s/^(Time?([-_]?Zone?)?|TZ)\s*=\s*//i) {
+    s/^['\"]//; s/['\"]$//;
+    $::opt_tz = $_;
X   } elsif (s/^Date?([-_]?Com(mand)?)?\s*=\s*//i) {
X     s/^['\"]//; s/['\"]$//;
X     $::opt_date = $_;
@@ -875,7 +912,7 @@
X 
X sub get_mtime_of_original_file   ( $ ) {
X   my $f = shift;
-  unless ($f =~ /(.*\/)?(.+)\.($IMGEXT)/) {
+  unless ($f =~ /(.*\/)?(.+)\.($IMGEXT)/o) {
X     die "!!BUG!! \$f=($f) : Bad image extension : ";
X   }
X   my $path  = ($1 ? "$1$picrawdir" : $picrawdir);
@@ -947,8 +984,9 @@
X $recommended
X 
X EOF
-    if ($VERSION ne $version and not exists $version_checked{$file}) {
-      warn <<EOF;
+    unless ($QUIET) {
+      if ($VERSION ne $version and not exists $version_checked{$file}) {
+       warn <<EOF;
X 
X Versions of $PNAME ($VERSION)
X      and of $file line $::ILN ($version)
@@ -956,12 +994,13 @@
X $recommended
X 
X EOF
-      if ($version =~ /-pre/i) {
-        warn <<EOF;
+       if ($version =~ /-pre/i) {
+         warn <<EOF;
X ### Mismatched pre-released-version may cause curious phenomena. ###
X ### Please take care!                                            ###
X 
X EOF
+       }
X       }
X     }
X   } else {
@@ -1194,7 +1233,7 @@
X     $info =~ s/\)\(/ /g;
X     $info =~ s/[()]//g;
X   }
-  unless ($image =~ /(.*)\.($IMGEXT)$/) {
+  unless ($image =~ /(.*)\.($IMGEXT)$/o) {
X     die "Bad image file name ($image) : ";
X   }
X   my ($base,$ext) = ($1,$2);
@@ -1346,10 +1385,12 @@
X 
X sub local_time ( ;$ ) {
X   my $mtime = shift;
-  if ($::opt_date) {
+  local($ENV{TZ}) = $::opt_tz if $::opt_tz;
+  if ($::opt_date or $::opt_tz) {
X     my $time = (defined $mtime ? gmctime($mtime) : gmctime());
X     $time =~ s/(\d+:\d+:\d+)/$1 UTC/;
-    my $date_command = $::opt_date;
+    my $date_command = ($::opt_date ? $::opt_date :
+                       ($::opt_tz ? "LANG=C $DATE_CMD" : $::opt_date));
X     $date_command =~ s/\$date\b/\'$time\'/;
X     my $date = qx($date_command);
X     die "Error on Date-Command :\n\t\"$date_command\"\n\t\t$!\n" if $?;
@@ -1444,7 +1485,7 @@
X       if (-r "$d/$CONTENT") {
X       push @tmp,$d;
X       } else {
-       warn "No $CONTENT under \"$pwd/$d/\"  ... skipped\n";
+       warn "No $CONTENT under \"$pwd/$d/\"  ... skipped\n" unless $QUIET;
X       }
X     }
X     @dirs = @tmp;
@@ -1463,10 +1504,26 @@
X 
X     my $mkshrink;
X     foreach my $f (@images) {
-      my ($base,$dir,$ext) = fileparse $f, '\.[^.]*';
-      push @images, $f if -r $f;
+      my $rawfile = image_path("Raw", $f);
+      if ($::opt_normsz) {
+       my ($x,$y) = imgsize($rawfile);
+       my $minimum = ($x <= $y ? $x : $y);
+       if ($minimum != $::opt_normsz) {
+         my $v = $::opt_normsz / $minimum;
+         die "$JPEGTOPNM : cannot be executed.\n" unless -x $JPEGTOPNM;
+         die "$PNMSCALE : cannot be executed.\n"  unless -x $PNMSCALE;
+         die "$PNMTOJPEG : cannot be executed.\n" unless -x $PNMTOJPEG;
+         system
+           "$JPEGTOPNM $rawfile 2>/dev/null | $PNMSCALE $v | $PNMTOJPEG >$rawfile.tmp";
+         die "Cannot normalize size $pwd/$rawfile.\n" if $?;
+         $rawfile =~ /(.+)\.($IMGEXT)/o;
+         my ($base,$ext) = ($1,$2);
+         rename "$rawfile","$base.$ORIG.$ext"
+           unless -r "$base.$ORIG.$ext"  or  -r "$base.$ext.$ORIG";
+         rename "$rawfile.tmp","$rawfile";
+       }
+      }
X       foreach my $scale (@sorted_scale[1..$#sorted_scale]) {
-       my $rawfile    = image_path("Raw", $f);
X       my $shrinkfile = image_path($scale,$f);
X       unless (-e "$shrinkfile"  &&
X           (stat($shrinkfile)->mtime > stat("$rawfile")->mtime)) {
@@ -1489,7 +1546,7 @@
X           die "$PNMSCALE : cannot be executed.\n"  unless -x $PNMSCALE;
X           die "$PNMTOJPEG : cannot be executed.\n" unless -x $PNMTOJPEG;
X           system
-             "$JPEGTOPNM $rawfile | $PNMSCALE $v | $PNMTOJPEG >$shrinkfile";
+             "$JPEGTOPNM $rawfile 2>/dev/null | $PNMSCALE $v | $PNMTOJPEG >$shrinkfile";
X         }
X         die "Cannot shrink $pwd/$rawfile.\n" if $?;
X         $should_be_updated = 1
@@ -1548,6 +1605,7 @@
X     local $::opt_mail    = $::opt_mail;
X     local $::opt_uname   = $::opt_uname;
X     local $::opt_charset = $::opt_charset;
+    local $::opt_normsz  = $::opt_normsz;
X     local $::opt_scale   = $::opt_scale;
X     local $::opt_size    = $::opt_size;
X     local $::opt_back    = $::opt_back;
@@ -1558,6 +1616,7 @@
X     local $::opt_prolog  = $::opt_prolog;
X     local $::opt_epilog  = $::opt_epilog;
X     local $::opt_ps      = $::opt_ps;
+    local $::opt_tz      = $::opt_tz;
X     local $::opt_date    = $::opt_date;
X     local $::utf8 = 0;
X 
@@ -1684,6 +1743,7 @@
X         ($theTheme_theme,$theTheme_image,$theTheme_comment,$theTheme_latest)
X           = get_theme_items("Theme");
X         print "#",__LINE__,"# CONFIG: Theme image : ($theTheme_image)\n" if $DEBUG;
+         $theTheme_theme = get_default_theme() unless $theTheme_theme;
X         if ($theTheme_image =~ m!/$!) {
X           die <<EOF unless -d $theTheme_image;
X Bad theme directory specified ($theTheme_image):
@@ -2019,7 +2079,7 @@
X       warn "Configuration file($CONFIG) exists but no image found\n",
X            " under $pwd ... ignored.\n";
X       } else {
-       warn "No image in \"$pwd/\" ... skipped.\n";
+       warn "No image in \"$pwd/\" ... skipped.\n" unless $QUIET;
X       }
X       next SPECIFIED_DIRECTORY;
X     }
@@ -2079,6 +2139,7 @@
X \tConfig=$::opt_config
X \tMail-Address=$::opt_mail
X \tUser-Name=$::opt_uname
+\tNormalize-Image-Size=$::opt_normsz
X \tScale-Directory=$::opt_scale
X \tSize-of-Picture=$::opt_size
X \tBack=$::opt_back
@@ -2089,6 +2150,7 @@
X \tPrologue=$::opt_prolog
X \tEpilogue=$::opt_epilog
X \tPostscript=$::opt_ps
+\tTime-Zone=$::opt_tz
X \tDate-Command=$::opt_date
X 
X Theme:
@@ -2313,8 +2375,6 @@
X EOF
X 
X       } elsif (exists $c->{ImageFile}) {         # Image file
-       $c->{ImageFile} =~ /(.*)(\.[^.]+)/;
-       my ($base,$ext) = ($1,$2);
X       my $ifile = image_path("Raw",$c->{ImageFile});
X       my $imagefiles = "<a href=\"$ifile\" "
X                      . "title=\"$c->{ImageFile}\">$sorted_scale[0]</a>";
@@ -2323,6 +2383,14 @@
X         $imagefiles .= "\n\t, <a href=\"$ifile\" "
X                      . "title=\"$c->{ImageFile}\">$scale</a>";
X       }
+       $ifile =~ /(.+)\.($IMGEXT)$/o;
+       my $origfile = "$1.$ORIG.$2";
+       if (-r $origfile) {
+         if ((stat("$origfile")->mode & 0444) == 0444) {
+           $imagefiles .= "\n\t, <a href=\"$origfile\" "
+             . "title=\"$c->{ImageFile}\">Orig</a>";
+         }
+       }
X       my $image_normal = image_path("Normal",$c->{ImageFile});
X       my $image_index  = image_path("Index", $c->{ImageFile});
X       my $size_index = html_imgsize($image_index);
diff -Nru Mkphotohtml_2.2/etc/getphotofromcard.conf.sample Mkphotohtml_2.3/etc/getphotofromcard.conf.sample
--- Mkphotohtml_2.2/etc/getphotofromcard.conf.sample    2003-11-11 15:16:42.000000000 +0900
+++ Mkphotohtml_2.3/etc/getphotofromcard.conf.sample    2006-09-08 15:49:16.000000000 +0900
@@ -12,6 +12,7 @@
X # History:
X #   29 Jul.2003   Version 1.0 : Released
X #   11 Nov.2003   Version 2.0 : Released
+#    8 Sep 2006   Version 2.3 : Released
X #
X 
X #
@@ -33,8 +34,8 @@
X # File path of the image files on the Card (maybe PCMCIA)
X #
X CARD="/card"                        # Mount point of the card.
-CHECKDIR="$CARD/dcim"                # check dir for the image card (Canon)
-IMAGEFILES="$CHECKDIR/*canon/img_*.jpg"              # Image files  (Canon)
+CHECKDIR="$CARD/dcim"                # check dir for the image card
+IMAGEFILES="$CHECKDIR/*/*.jpg"       # Image files
X 
X # Eject the card after read all image files.
X #
diff -Nru Mkphotohtml_2.2/etc/getphotofromusb.conf.sample Mkphotohtml_2.3/etc/getphotofromusb.conf.sample
--- Mkphotohtml_2.2/etc/getphotofromusb.conf.sample     1970-01-01 09:00:00.000000000 +0900
+++ Mkphotohtml_2.3/etc/getphotofromusb.conf.sample     2006-09-08 15:49:49.000000000 +0900
@@ -0,0 +1,46 @@
+# getphotofromusb.conf
+# --------------------- : Configure getphotofromusb
+#
+
+# Author:
+#      YAMADA Kunihiro <king@tksa.gr.jp>
+#                      (http://www.tksa.gr.jp/king/)
+#
+# Copyright policy:
+#      GNU GPL Ver.2
+#
+# History:
+#    8 Sep.2006   Version 2.3 : Released
+#
+
+#
+# This is same as default configuration option setting
+# in the getphotofromusb script.
+#
+
+
+# Permission
+#
+UMASK=022
+FPERMISSION=0644               # File permission for raw images
+
+# Target theme directory and it's subdirectory for raw image files.
+#
+THEME_DIR="/home/www1/$USER/Photos/incoming" # Theme directory
+RAW=":raw"                   # subdirectory for raw image files
+
+# File path of the image files on the Usb
+#
+USB="/.usb"                  # Mount point of the usb.
+CHECKDIR="$USB/dcim"         # check dir for the image usb
+IMAGEFILES="$CHECKDIR/*/*.jpg"       # Image files
+
+# Umount the usb after read all image files.
+#
+UMOUNT="Yes"                 # "Yes" or "No"
+
+# Action when invoked by non-allowed user.
+#      Note: This will take effect only on the system wide configuration
+#            file (/etc/mkphotohtml/getphotofromusb.conf).
+# 
+NO_ALLOW="Ignore"                    # "Ignore" or "Prohibitted"
diff -Nru Mkphotohtml_2.2/etc/option.sample Mkphotohtml_2.3/etc/option.sample
--- Mkphotohtml_2.2/etc/option.sample   2004-03-05 00:20:02.000000000 +0900
+++ Mkphotohtml_2.3/etc/option.sample   2006-09-07 00:09:02.000000000 +0900
@@ -22,7 +22,7 @@
X #
X 
X Version:
-       mkphotohtml 2.0
+       mkphotohtml 2.3
X 
X Option:
X             Charset = iso-2022-jp
@@ -33,6 +33,7 @@
X              Config = Non
X        Mail-Address = $userid@$domain
X           User-Name = $passwd
+Normalize-Image-Size= size = 1200
X     Scale-Directory = (1/1=:raw)(1/2=:shrink)(1/4=:shrink)(1/8=:shrink)
X     Size-of-Picture = (Normal=1/2)(Header=1/4)(Index=1/8)
X                Back = No
@@ -42,4 +43,6 @@
X               Refer = Deny
X            Prologue = "$copyright: $uname <$Mail>"
X            Epilogue = ""
+         Postscript = This was created by Mkphotohtml. Reference/Link to this webpage is $refer."
+          Time-Zone = "Asia/Tokyo"
X        Date-Command = ""
SHAR_EOF
  (set 20 06 09 08 16 33 42 'mkphotohtml.bin.diff'; eval "$shar_touch") &&
  chmod 0640 'mkphotohtml.bin.diff' ||
  $echo 'restore of' 'mkphotohtml.bin.diff' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'mkphotohtml.bin.diff:' 'MD5 check failed'
716d6b0b009e383f273c212a91fb46bb  mkphotohtml.bin.diff
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'mkphotohtml.bin.diff'`"
    test 29629 -eq "$shar_count" ||
    $echo 'mkphotohtml.bin.diff:' 'original size' '29629,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh01596
exit 0
##### (END) cut here for binaries #####