#!/usr/local/bin/perl # 時刻によって画像を変える(GIF形式) # id=gazo.cgi # update 97.10.17 # 今日 ($ss,$mm,$hh,$sysdd,$sysmm,$sysyy,$t7) = localtime; # 月補正 $sysmm++; # 例えば、月によっても変えたいのなら #if ($sysmm == 1) { # 冬の画像 } #if ($sysmm == 4) { # 春の画像 } #if ($sysmm == 7) { # 夏の画像 } #if ($sysmm == 10) { # 秋の画像 } # 時刻によって変えたいのなら if ($hh <= 6) { $img = "/dialup/chichibu/gazo/gal1.gif"; } #深夜、早朝 elsif ($hh <= 12) { $img = "/dialup/chichibu/gazo/gal2.gif"; } #午前 elsif ($hh <= 18) { $img = "/dialup/chichibu/gazo/gal3.gif"; } #午後 else { $img = "/dialup/chichibu/gazo/gal4.gif"; } #夜 # 画像ファイルを開く open (GIF, $img); flock(GIF,2); # 画像ファイルの情報(ファイルサイズ)を取り出す @gifdata = stat($img); $byte = $gifdata[7]; # ヘッダを出力 print "Content-type: image/gif\n"; print "Content-length: $byte\n"; # ヘッダの終わりを出力 print "\n"; # 画像ファイルの中味を表示 print ; # 画像ファイルを閉じる flock(GIF,8); close(GIF); ############# end of script ##################