;## --- PC版記事表示 sub pc_top { local ($yr,$mn,$da,$week,$sub,$word,$writer,$cat,$imsz,$imgfile) = @_; $sub2 = &mobile'o2emoji("$sub","$emo_dir","$mobile"); $sub = &mobile'o2mark("$sub"); $word = &mobile'o2emoji("$word","$emo_dir","$mobile"); @imsz = split(/\,/,$imsz); $s=1; foreach $is (@imsz) { ($w[$s],$h[$s]) = split(/:/,$is); $s++; } print "\n"; print "
\n"; print "$sub2
\n"; print "
$yr/$mn/$da($weeks[$week])

\n"; @imgflag=(); if (!($imgfile)) { $imgfile = "$img_dir\/$yr$mn$da\_"; } foreach $m (1 .. $img_upload) { $word =~ s/\[img($m):?([a-z]+)?\](
)?/&wordimg("$2","$3")/eg; } $word =~ s/\[img(\d+)\](
)?/&wordimg2("$1")/eg; $maxh = 0; @wid=(); @hei=(); # 画像数をカウントする $imgcnt=0; $imgcnt2=0; foreach $num (1 .. $img_upload) { if ($imgflag[$num]) { $imgcnt2++; next; } if (-e "$imgfile$num.jpg" || -e "$imgfile$num.gif") { $imgcnt++; $imgcnt2++; } } if ($imgcnt) { ($wl , $hl) = &img_limit($imgcnt); foreach $r (1 .. $img_upload) { if (!($w[$r]) || $imgflag[$r]) { next; } # $fg[$r]=1; ($wid[$r],$hei[$r],$fg[$r]) = &imgresize("$wl","$hl","$w[$r]","$h[$r]"); if ($maxh < $hei[$r]) { $maxh = $hei[$r]; } } $maxh = int ($maxh / 20) * 20 + 20; print "
\n"; print "\n"; foreach $num (1 .. $img_upload) { if (!($imgflag[$num])) { &img("$num","$w[$num]","$h[$num]"); } } print "
\n"; print "

\n"; } print "$word

\n"; if ($writer || ($category_mode && $FORM{'c'} eq "") || ($com_mode && ($FORM{'d'} !~ /\d{8}/ && $FORM{'no'} eq ""))) { $fg=0; print "
"; if ($cat ne "" && $category_mode) { foreach $ct (split(/:/, $cat)) { if ($cat[$ct]) { if ($fg) { print " - "; } print " $cat[$ct] "; $fg=1; } } } if ($com_mode) { if ($FORM{'d'} !~ /\d{8}/ && $FORM{'no'} eq "" && $no) { if ($fg) { print " │ "; } $fg=1; if ($com{$no}) { $com{$no} = "($com{$no})"; } print "コメント$com{$no}"; } } if ($writer) { if ($fg) { print " │ "; } print "$writer "; } print "
\n"; } print "

\n\n"; print "

\n\n"; if ($FORM{'d'} =~ /\d{8}/ || $FORM{'no'} ne "") { &bbs; } } sub wordimg { $imgflag[$m]=1; $print = ""; if ($_[0] =~ /^(left|right|center)$/) { $align = " align=\"$1\""; } else { $align=""; $_[0] = ""; } if (-e "$imgfile$m.jpg") { $filetype = "jpg"; } elsif (-e "$imgfile$m.gif") { $filetype = "gif"; } else { return; } # --- 縮小表示の設定 if ($_[0] eq "center") { ($w,$h,$imfg) = &imgresize("480","480","$w[$m]","$h[$m]"); } else { ($w,$h,$imfg) = &imgresize("240","240","$w[$m]","$h[$m]"); } $h2 = int ($h / 20) * 20 + 20; # --- ファイルサイズ $size = -s "$imgfile$m.$filetype"; if ($size > 1024) { $size = int($size*10/1024)/10 . "K"; } if ($_[0] eq "center" || $_[0] eq "") { $print .= ""; if ($_[0] eq "center") { $print .= "
\n"; } else { $print .= ""; } } if ($imfg) { unless (-e "./lightbox.js") { $print .= ""; } else { $print .= ""; } } $print .= "\"$w[$m]×$h[$m]\pixel(約$size\B)\""; if ($imfg) { $print .= ""; } if ($_[0] eq "center" || $_[0] eq "") { $print .= "
\n"; } else { $print .= "$_[1]"; } return "$print\n"; } sub wordimg2 { $print = ""; $cnt = length($_[0]); ($wl,$hl) = &img_limit($cnt); $maxh = 0; @wid=(); @hei=(); @ig=(); foreach $r ( split(//, $_[0]) ) { if ($_[0] !~ /$r/ || !($w[$r])) { next; } else { push (@ig ,"$r") } ($wid[$r],$hei[$r],$fg[$r]) = &imgresize("$wl","$hl","$w[$r]","$h[$r]"); if ($maxh < $hei[$r]) { $maxh = $hei[$r]; } } $maxh = int ($maxh / 20) * 20 + 20; $print .= "
\n"; $print .= "\n"; foreach $m (@ig) { $imgflag[$m]=1; if (-e "$imgfile$m.jpg") { $filetype = "jpg"; } elsif (-e "$imgfile$m.gif") { $filetype = "gif"; } else { next; } $size = -s "$imgfile$m.$filetype"; if ($size > 1024) { $size = int($size*10/1024)/10 . "K"; } $print .= ""; } $print .= "
"; if ($fg[$m]) { unless (-e "./lightbox.js") { $print .= ""; } else { $print .= ""; } } $print .= "\"$w[$m]×$h[$m]\pixel(約$size\B)\""; if ($fg[$m]) { $print .= ""; } $print .= "
\n"; $print .= "
\n"; return "$print\n"; } sub img_limit { local ($cnt) = $_[0]; if ($cnt == 1) { return ('300','240'); } elsif ($cnt == 2) { return ('240','240'); } elsif ($cnt == 3) { return ('190','190'); } else { return ( int(568/$cnt - 2) , int(568/$cnt) - 2); } } sub imgresize { my ($mw,$mh,$width,$height) = @_; my $ifg = 1; if ($width > $height && $width > $mw) { $w = $mw; $h = int($height*$mw/$width); } elsif ($width <= $height && $height > $mh) { $h = $mh; $w = int($width*$mh/$height); } else { $w = $width; $h = $height; $ifg = 0; } return ($w,$h,$ifg); } sub img { local ($num,$wd,$hg) = @_; if (-e "$imgfile$num.jpg") { &img2("jpg"); } elsif (-e "$imgfile$num.gif") { &img2("gif"); } } sub img2 { local ($filetype) = @_; $size = -s "$imgfile$num.$filetype"; if ($size > 1024) { $size = int($size*10/1024)/10 . "K"; } print ""; if ($fg[$num]) { unless (-e "./lightbox.js") { print ""; } else { print ""; } } print "\"$wd×$hg\pixel(約$size\B)\""; if ($fg[$num]) { print ""; } print "\n"; } 1;