]> www.average.org Git - mkgallery.git/commitdiff
restoring lost changes: incpath and utf8 jpeg comments
authorEugene Crosser <crosser@average.org>
Sun, 17 Dec 2006 09:03:35 +0000 (09:03 +0000)
committerEugene Crosser <crosser@average.org>
Sun, 17 Dec 2006 09:03:35 +0000 (09:03 +0000)
README
mkgallery.pl

diff --git a/README b/README
index 7c3cc0b5a32894c32fabdbb6b154436d62ad94a5..b6cb4ccdc343dbc74c6fcfc1b8f714f9c4f91112 100644 (file)
--- a/README
+++ b/README
@@ -41,6 +41,8 @@ there.  This way you can preserve index created by hand or by some other
 script like "mkindex.pl".
 
 command-line options:
+ --incpath:     do not try to fine .include diretory upstream, use
+               specified path (absolute or relavive).  Use with causion.
  --debug:      print a lot of debugging info to stdout as you run
  --asktitle:   ask to edit album titles even if there are ".title" files
  --noasktitle: don't ask to enter album titles even where ".title"
index 6ca18eb5a0c199ab1af887a733bf71a1545108f9..1a3688439edf8acf58a7d031b90c9bf85b4f9974 100755 (executable)
@@ -33,6 +33,9 @@ use CGI qw/:html *table *Tr *center *div/;
 use Image::Info qw/image_info dim/;
 use Term::ReadLine;
 use Getopt::Long;
+use Encode;
+use encoding 'utf-8';
+binmode(STDOUT, ":utf8");
 
 my $haveimagick = eval { require Image::Magick; };
 { package Image::Magick; }     # to make perl compiler happy
@@ -41,11 +44,15 @@ my @sizes = (160, 640);
 
 ######################################################################
 
+my $incpath;
 my $debug = 0;
 my $asktitle = 0;
 my $noasktitle = 0;
 
-GetOptions('asktitle'=>\$asktitle,
+charset("utf-8");
+
+GetOptions(    'incpath'=>\$incpath,
+               'asktitle'=>\$asktitle,
                'noasktitle'=>\$noasktitle,
                'debug'=>\$debug);
 
@@ -92,6 +99,10 @@ sub getinc {
        my $fullpath=shift;     # this is not a method
        my $depth=20;           # arbitrary max depth
 
+       if ($incpath) {
+               return $incpath."/.include";
+       }
+
        my $inc=".include";
        while ( ! -d $fullpath."/".$inc ) {
                $inc = "../".$inc;
@@ -370,7 +381,7 @@ sub makeaux {
        my $title = $self->{-info}->{'Comment'};
        $title = $name unless ($title);
 
-       print "slide: \"$pref\"->\"$name\"->\"$nref\"\n" if ($debug);
+       print "slide: \"$title\": \"$pref\"->\"$name\"->\"$nref\"\n" if ($debug);
 
        # slideshow
        for my $refresh('static', 'slide') {
@@ -403,8 +414,10 @@ sub makeaux {
                                warn "cannot open \"$fn\": $!";
                                next;
                        }
+                       binmode($F, ":utf8");
                        if ($refresh eq 'slide') {
                                print $F start_html(
+                                       -encoding=>"utf-8",
                                        -title=>$title,
                                        -bgcolor=>"#808080",
                                        -head=>meta({-http_equiv=>'Refresh',
@@ -414,6 +427,7 @@ sub makeaux {
                                                
                        } else {
                                print $F start_html(-title=>$title,
+                                       -encoding=>"utf-8",
                                        -bgcolor=>"#808080",
                                        -style=>{-src=>$inc."gallery.css"},
                                        ),"\n";
@@ -445,6 +459,7 @@ sub makeaux {
                }
                my $imgsrc = sprintf("../.%s/%s",$sizes[0],$name);
                print $F start_html(-title=>$title,
+                               -encoding=>"utf-8",
                                -style=>{-src=>$inc."gallery.css"},),"\n",
                        start_center,"\n",
                        h1($title),"\n",
@@ -468,11 +483,13 @@ sub startindex {
                warn "cannot open $fn: $!";
                return;
        }
+       binmode($IND, ":utf8");
        $self->{-IND} = $IND;
 
        my $inc = $self->{-inc};
        my $title = $self->{-title};
        print $IND start_html(-title => $title,
+                       -encoding=>"utf-8",
                        -style=>{-src=>[$inc."gallery.css",
                                        $inc."lightbox.css"]},
                        -script=>[{-code=>"var incPrefix='$inc';"},