X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=mkgallery.pl;h=6b3febe6c8a3adfd40aa75859d6b4a4cd8875f7d;hp=c7d3f46391a0e2a1b1e3271b90f5b208497a9726;hb=b9bad7137ebc39fc083b04b3a17db5555f6b6f22;hpb=e04e3b035dbc99e57bd2b37fb68696718a825297 diff --git a/mkgallery.pl b/mkgallery.pl index c7d3f46..6b3febe 100755 --- a/mkgallery.pl +++ b/mkgallery.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id$ +my $version='$Id$'; # Recursively create image gallery index and slideshow wrappings. # Makes use of modified "slideshow" javascript by Samuel Birch @@ -74,21 +74,14 @@ if ($rssfile && ! $haverssxml) { my $term = new Term::ReadLine "Edit Title"; FsObj->new(getcwd)->iterate; - -if ($rssobj) { - my $itemstodel = @{$rssobj->{'rss'}->{'items'}} - 15; - while ($itemstodel-- > 0) { - pop(@{$rssobj->{'rss'}->{'items'}}) - } - $rssobj->{'rss'}->save($rssobj->{'file'}); -} +if ($rssobj) { $rssobj->{'rss'}->save($rssobj->{'file'}); } sub help { print STDERR <<__END__; usage: $0 [options] --help: print help message and exit - --incpath: do not try to find .include diretory upstream, use + --incpath: do not try to find .gallery2 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 @@ -142,10 +135,10 @@ sub getinc { my $depth=20; # arbitrary max depth if ($incpath) { - return $incpath."/.include"; + return $incpath."/.gallery2"; } - my $inc=".include"; + my $inc=".gallery2"; while ( ! -d $fullpath."/".$inc ) { $inc = "../".$inc; last unless ($depth-- > 0); @@ -172,6 +165,11 @@ sub getrss { $rssobj->{'file'} = $rss; $rssobj->{'rss'} = new XML::RSS (version=>2); $rssobj->{'rss'}->parsefile($rss); + my $itemstodel = @{$rssobj->{'rss'}->{'items'}} - 15; + while ($itemstodel-- > 0) { + pop(@{$rssobj->{'rss'}->{'items'}}) + } + $rssobj->{'rss'}->save($rssobj->{'file'}); return $rss; } else { print STDERR "There is no $rssfile in this or parent ". @@ -401,7 +399,8 @@ sub makescaled { $self->{$size}->{'dim'} = [$w, $h]; } else { $self->{$size}->{'url'} = $nref; - $self->{$size}->{'dim'} = [$w*$factor, $h*$factor]; + $self->{$size}->{'dim'} = [int($w*$factor+.5), + int($h*$factor+.5)]; if (isnewer($fn,$nfn)) { doscaling($fn,$nfn,$factor,$w,$h); } @@ -454,7 +453,7 @@ sub makeaux { for my $refresh('static', 'slide') { my $fn = sprintf("%s/.html/%s-%s.html",$dn,$name,$refresh); if (isnewer($self->{-fullpath},$fn)) { - my $imgsrc = '../'.$self->{$sizes[1]}; + my $imgsrc = '../'.$self->{$sizes[1]}->{'url'}; my $fwdref; my $bakref; if ($nref) { @@ -490,27 +489,27 @@ sub makeaux { -head=>meta({-http_equiv=>'Refresh', -content=>"3; url=$fwdref"}), -style=>{-src=>$inc."gallery.css"}, - ),"\n"; + ),"\n", + comment("Created by ".$version),"\n"; } else { print $F start_html(-title=>$title, -encoding=>"utf-8", -bgcolor=>"#808080", -style=>{-src=>$inc."gallery.css"}, - ),"\n"; + ),"\n", + comment("Created by ".$version),"\n"; } - print $F start_center,"\n", - h1($title),"\n", - start_table({-class=>'navi'}),start_Tr,"\n", + print $F start_table({-class=>'navi'}),start_Tr,"\n", td(a({-href=>"../index.html"},"Index")),"\n", td(a({-href=>$bakref},"<<Prev")),"\n", td(a({-href=>$toggleref},$toggletext)),"\n", td(a({-href=>$fwdref},"Next>>")),"\n", + td({-class=>'title'},$title),"\n", end_Tr, end_table,"\n", - table({-class=>'picframe'}, - Tr(td(img({-src=>$imgsrc})))),"\n", - end_center,"\n", + center(table({-class=>'picframe'}, + Tr(td(img({-src=>$imgsrc}))))),"\n", end_html,"\n"; close($F); } @@ -527,13 +526,20 @@ 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", + -style=>{-src=>$inc."gallery.css"}, + -script=>[ + {-src=>$inc."mootools.js"}, + {-src=>$inc."urlparser.js"}, + {-src=>$inc."infopage.js"}, + ]),"\n", + comment("Created by ".$version),"\n", start_center,"\n", h1($title),"\n", table({-class=>'ipage'}, Tr(td(img({-src=>$imgsrc})), td($self->infotable))), - a({-href=>'../index.html'},'Index'),"\n", + a({-href=>'../index.html',-class=>'conceal'}, + 'Index'),"\n", end_center,"\n", end_html,"\n"; close($F); @@ -571,10 +577,14 @@ sub startindex { {-src=>$inc."overlay.js"}, {-src=>$inc."urlparser.js"}, {-src=>$inc."multibox.js"}, - {-src=>$inc."slideshow.js"}, + {-src=>$inc."showwin.js"}, + {-src=>$inc."controls.js"}, + {-src=>$inc."show.js"}, {-src=>$inc."gallery.js"}, - {-code=>"var incPrefix='$inc';"} - ]), + ]),"\n", + comment("Created by ".$version),"\n", + start_div({-class => 'indexContainer', + -id => 'indexContainer'}), a({-href=>"../index.html"},"UP"),"\n", start_center,"\n", h1($title),"\n", @@ -585,7 +595,7 @@ sub endindex { my $self = shift; my $IND = $self->{-IND}; - print $IND end_center,end_html,"\n"; + print $IND end_center,end_div,end_html,"\n"; close($IND) if ($IND); undef $self->{-IND}; @@ -634,28 +644,9 @@ sub startimglist { my $first = $self->{-firstimg}->{-base}; my $slideref = sprintf(".html/%s-slide.html",$first); - print $IND h2("Images"),"\n", - a({-href=>$slideref, - -onClick=>"return run_slideshow(-1);"}, - 'Slideshow'), - start_div({-id=>"slideshowWindow",-class=>"slideshowWindow"}), - div({-id=>"slideshowContainer", - -class=>"slideshowContainer"},""), - start_div({-id=>"slideshowControls", - -class=>"slideshowControls"}), - a({-href=>"#",-onClick=>"show.previous();return false;"}, - "Prev"), - a({-href=>"#",-onClick=>"show.play();return false;"}, - "Play"), - a({-href=>"#",-onClick=>"show.stop();return false;"}, - "Stop"), - a({-href=>"#",-onClick=>"show.next();return false;"}, - "Next"), - a({-href=>"#",-onClick=>"stop_slideshow();return false;"}, - "Exit"), - end_div, - end_div, - "\n"; + print $IND h2("Images ", + a({-href=>$slideref,-class=>'showStart',-id=>$first}, + '> slideshow')),"\n"; } sub img_entry { @@ -670,42 +661,33 @@ sub img_entry { my $i=0+$self->{-parent}->{-numofimgs}; $self->{-parent}->{-numofimgs}++; - print $IND start_div({-class=>'ibox',-id=>$name, - -OnClick=>"HideIbox('$name');"}),"\n", - start_div({-class=>'iboxtitle'}), - span({-style=>'float: left;'},b("Info for $name")), - span({-style=>'float: right;'}, - a({-href=>"#",-OnClick=>"HideIbox('$name');"},"Close")), - br({-clear=>'all'}),"\n", - end_div,"\n", - $self->infotable, - end_div,"\n"; - - print $IND a({-name=>$i}),"\n", + + print $IND a({-name=>$name}),"\n", start_table({-class=>'slide'}),start_Tr,start_td,"\n", div({-class=>'slidetitle',-id=>$name}, - a({-href=>".html/$name-info.html", - -title=>'Image Info', - -class=>'infobox'}, - $title)),"\n", + "\n ",a({-href=>".html/$name-info.html", + -title=>'Image Info: '.$name, + -class=>'infoBox'}, + $title),"\n"),"\n", div({-class=>'slideimage',-id=>$name}, - a({-href=>".html/$name-static.html",-title=>$title, - -id=>$name, - -OnClick=>"return run_slideshow(".$i.");"}, - img({-src=>$thumb}))),"\n", - start_div({-class=>'varimages',-id=>$i}); + "\n ",a({-href=>".html/$name-static.html", + -title=>$title, + -class=>'showImage', + -id=>$name}, + img({-src=>$thumb})),"\n"),"\n", + start_div({-class=>'varimages',-id=>$name,-title=>$title}),"\n"; foreach my $sz(@sizes) { my $src=$self->{$sz}->{'url'}; my $w=$self->{$sz}->{'dim'}->[0]; my $h=$self->{$sz}->{'dim'}->[1]; - print $IND a({-href=>$src,-style=>"display: none;", - -class=>($sz == 640)?"slideshowThumbnail":"", + print $IND " ",a({-href=>$src, + -class=>"conceal", -title=>"Reduced to ".$w."x".$h}, - $w."x".$h)," "; + $w."x".$h)," \n"; } - print $IND a({-href=>$name, + print $IND " ",a({-href=>$name, -title=>'Original'},$w."x".$h), - end_div,"\n", + "\n",end_div,"\n", end_td,end_Tr,end_table,"\n"; }