X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=imagedir;h=3ca94031475af9f5ddbc1741b34c7b9b1c830559;hb=12e2a3511d9098ca03b6614b53b8c7b09efe5443;hp=b11888229b171e704c410474879065e0b4170d37;hpb=c32d5aaa4789c7b9c91277e27ec90a8944e6852d;p=oss%2Fimgwww.git diff --git a/imagedir b/imagedir index b118882..3ca9403 100755 --- a/imagedir +++ b/imagedir @@ -1,4 +1,8 @@ #!/usr/bin/perl +use utf8; +use Encode; +use locale; +use open OUT => ":locale"; use constant THUMBSIZE => 150; use constant COLUMNS=>5; use constant THUMBDIR=>".thumbs"; @@ -60,12 +64,14 @@ my $dir = $opt_t || (split ("/",cwd()))[-1]; mkdir THUMBDIR if (! -d THUMBDIR); mkdir INLINEDIR if (! -d INLINEDIR); my $i=0; -open OUT,">index.html"; +open OUT,">","index.html"; print OUT "$dir\n\n

$dir

\n" ."

back

". "\n"; -my @piclist=(<*.jpg>,<*.gif>,<*.png>) ; -print STDERR "@piclist\n"; +my @piclist=grep (/\.(jpe?g|png|tiff?|gif)$/i, <*>) ; +my @movielist= grep(/\.(mp4|avi|flv|mpg)$/i,<*>); +print STDERR "Pictures found @piclist\n"; +print STDERR "Videos found @movielist\n"; my ($prev,$next); for ($j=0;$j<=$#piclist;$j++) { $_ = $piclist[$j]; @@ -76,6 +82,7 @@ for ($j=0;$j<=$#piclist;$j++) { $next = undef; } print STDERR "$j:$_"; + chmod 0644, $_; my $info = image_info($_); my $thumbname=rescale($_,THUMBDIR,THUMBSIZE,$info); my $inlinename=rescale($_,INLINEDIR,INLINESIZE,$info); @@ -114,9 +121,7 @@ sub rescale { sub make_comment_html { my $info = shift; -my $comment = - - ref($info->{"Comment"})?join("\n",@{$info->{"Comment"}}):$info->{"Comment"}; +my $comment = Encode::decode("koi8-r",ref($info->{"Comment"})?join("\n",@{$info->{"Comment"}}):$info->{"Comment"}); $comment =~s/\&/&/; $comment =~s/"/"/; $comment =~s/>/>/; @@ -129,7 +134,7 @@ sub make_html { my $info = shift; my $comment = shift; my $inline = shift; - open HTML, ">$imgfile.html"; + open HTML, ">", "$imgfile.html"; my ($w,$h) = dim($info); my ($w1,$h1) = dim(image_info(INLINEDIR."/".$imgfile)); print HTML "$dir:$imgfile