写真一覧を表示
tableタグを使って、1時間ごとにまとめて写真を表示するようにする。
スクリプト
#!/usr/bin/perlrequire "./jcode.pl";
$PREV = "←前へ";
$NOW = "現在時刻";
$NEXT = "次へ→";
&jcode'convert(*PREV,'euc');
&jcode'convert(*NOW,'euc');
&jcode'convert(*NEXT,'euc');
$|=1;
$url = "../../camera_img/";
$hh = sprintf("%02d",$ENV{'QUERY_STRING'});
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime();
if ($hh == 99) {
$hh = sprintf("%02d",$hour);
} elsif ($hh < 0) {
$hh = "23";
} elsif ($hh > 23) {
$hh = "00";
}
print "Content-type: text/html\n\n";
print <<EOF;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;CHARSET=euc-jp">
<META HTTP-EQUIV="expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<title>Photos</title>
<script language="JavaScript">
<!--
function opnWindow(allowURL) {
window.open(allowURL,'window','scrollbars=no,width=660,height=505');
}
//-->
</script>
</head>
<body bgcolor="#ffffff">
<div align="center">
<hr>
<font size="+2">$hh:00 - $hh:55</font>
<hr>
<br>
EOF
&CreateTable(0);
print "<br>";
&CreateTable(30);
print "<br>";
print"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>";
printf "<td align=\"left\" width=\"150\"><a href=\"./cam_right.cgi?%02d\">%s</a></td>", $hh-1, $PREV;
printf "<td align=\"center\" width=\"150\"><a href=\"./cam_right.cgi?%02d\">%s</a></td>", $hour, $NOW;
printf "<td align=\"right\" width=\"150\"><a href=\"./cam_right.cgi?%02d\">%s</a></td>", $hh+1, $NEXT;
print <<EOF;
</tr></table>
</div>
</body>
</html>
EOF
#
#
#
sub CreateTable{
local $plus = $_[0];
print "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
print "<tr bgcolor=\"#00dd33\" align=\"center\">";
for($m=0; $m<=5; $m++){
$mm = sprintf("%02d",$m*5+$plus);
print "<td>$hh:$mm</td>";
}
print "</td></tr>\n";
print "<tr>\n";
for($m=0; $m<=5; $m++){
$mm = sprintf("%02d",$m*5+$plus);
$photo = "p$hh$mm".'.jpg';
$photo_t = "p$hh$mm".'t.jpg';
print "<td><a href=\"\" onClick=\"opnWindow('$url$photo');return false;\"><img src=\"$url$photo_t\" width=\"128\" height=\"96\" border=\"0\" alt=\"$hh:$mm\"></a></td>\n";
}
print "</tr>\n";
print "</table>\n";
}