File "view_map.php"
Full path: /www/ri/view_map.php
File size: 6.63 KiB (6785 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
// ===============================================
// GD処理準備
// 備考 :
// 更新 : 2010/09/08 KMK T.Teraoka
// ===============================================
//$img = imagecreatetruecolor(1000,670); //パレットの作成
$font1 = "/usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf";
$img = imagecreate(500,850); //パレットの作成
// 使用色の準備
$Black = imagecolorallocate($img, 0,0,0);
$White = imagecolorallocatealpha($img, 255, 255, 255,75);
$WhiteBg = imagecolorallocatealpha($img, 255, 255, 255);
$Red = imagecolorallocate($img, 255, 0, 0);
$WBlue = imagecolorallocate($img, 37, 235, 253);
$Blue = imagecolorallocate($img, 0, 0, 255);
$Blue2 = imagecolorallocate($img, 30,144,255);
imagefill($img, 0, 0, $White);
$now_time = time();
/*
//////////////////////////////
$fp = fopen("/www/shimooguni/recv/new_data_log.txt", "r");
$fp_wv_data = fopen("/www/shimooguni/recv/new_wv_data.txt", "r");
$fp_rain_data = fopen("/www/shimooguni/recv/new_rain_data.txt", "r");
$data = fgets($fp);
$wv_data = fgets($fp_wv_data);
$rain_data = fgets($fp_rain_data);
$data_d = explode(",", $data);
$wv_data_d = explode(",",$wv_data);
$rain_data_d = explode(",",$rain_data);
/////////////////////
fclose($fp);
fclose($fp_wv_data);
fclose($fp_rain_data);
///////////////////////////////////////////////////////////////////////////
*/
// 更新時間をマップに表示する
$up_check = date("Y年m月d日(" .$week[date('w')] .") H時i分s秒" ,time());
//データカウントログ取得
$ct_data = file_get_contents("ct_n.log");
$ct_data_ = explode(",",$ct_data);
//データカウントログ取得
$send_data = file_get_contents("ct_send.log");
$send_data_ = explode(",",$send_data);
imagettftext($img, 20, 0, 10,42, $Black, $font1, "通信状態 :");
$filename = "new_gps.log";
if (file_exists($filename))
{
$now_time = time();
$up_time = filemtime($filename);
$time_ = $now_time - $up_time;
if($time_ < 30)
{
imagettftext($img, 25, 0, 180,42, $Black, $font1, "○");
}
else
{
imagettftext($img, 25, 0, 180,42, $Black, $font1, "×");
}
}
//未送信データ数
ImageRectangle($img, 0,50, 495,270, $Black);
imageline($img, 160,50,160,270, $Black);
imageline($img, 305,50,305,270, $Black);
imageline($img, 0,90,495,90, $Black);
imageline($img, 0,180,495,180, $Black);
imagettftext($img, 25, 0, 30,145, $Black, $font1, "未送信");
imagettftext($img, 25, 0, 165,80, $Black, $font1, "データ数");
imagettftext($img, 25, 0, 360,80, $Black, $font1, "日時");
imagettftext($img, 25, 0, 15,235, $Black, $font1, "前回送信");
//未送信データ・日時
imagettftext($img, 25, 0, 200,145, $Black, $font1, $ct_data_[1]);
imagettftext($img, 14, 0, 310,145, $Black, $font1, $ct_data_[0]);
//前回送信したデータ・日時
imagettftext($img, 25, 0, 200,235, $Black, $font1, $send_data_[1]);
imagettftext($img, 14, 0, 310,235, $Black, $font1, $send_data_[0]);
ImageFilledRectangle($img, 0,300, 570,850, $WBlue );
imagesetthickness($img,5);
ImageRectangle($img, 2,300, 498,848, $Black);
$send_flag = file_get_contents("sendflag.txt");
if($send_flag)
{
imagettftext($img, 80, 0, 30,620, $Black, $font1, "送信待ち");
}
else
{
imagettftext($img, 80, 0, 120,620, $Black, $font1, "送信");
}
//imagettftext($img, 80, 0, 30,570, $Black, $font1, "送信待ち");
//imagettftext($img, 20, 0, 100,300, $Blue, $font1, "送信待ち");
/*
imagettftext($img, 12, 0, 10,292, $Blue, $font1, "■熱中度(WBGT) / 不快指数");
imageline($img, 5,295,1050,295, $Blue2);
imagettftext($img, 15, 0, 10,340, $Black, $font1, "熱中指数:");
imagettftext($img, 25, 0, 100,340, $Black, $font1, $nechu_);
//imagettftext($img, 15, 0, 220,340, $Black, $font1, "hPs");
imageline($img, 10,345,250,345, $Black);
imagettftext($img, 15, 0, 510,340, $Black, $font1, "不快指数:");
imagettftext($img, 25, 0, 600,340, $Black, $font1, $hukai_);
//imagettftext($img, 15, 0, 220,500, $Black, $font1, "hPs");
imageline($img, 510,345,750,345, $Black);
*/
/*
imagettftext($img, 12, 0, 10,392, $Blue, $font1, "■風向 / 風速");
imageline($img, 5,395,1050,395, $Blue2);
imagettftext($img, 15, 0, 10,440, $Black, $font1, "風向:");
imagettftext($img, 25, 0, 200,440, $Black, $font1, $wd_);
imageline($img, 10,445,400,445, $Black);
imagettftext($img, 15, 0, 460,440, $Black, $font1, "風速:");
imagettftext($img, 25, 0, 620,440, $Black, $font1, $wv_);
imagettftext($img, 15, 0, 720,440, $Black, $font1, "m/s");
imageline($img, 460,445,900,445, $Black);
imagettftext($img, 15, 0, 10,490, $Black, $font1, "平均風速:");
imagettftext($img, 13, 0, 10,510, $Black, $font1, "(前10分間の平均値)");
imagettftext($img, 25, 0, 200,510, $Black, $font1, $wv_avg_);
imagettftext($img, 15, 0, 320,510, $Black, $font1, "m/s");
imageline($img, 10,515,400,515, $Black);
imagettftext($img, 15, 0, 460,510, $Black, $font1, "最大瞬間風速:");
imagettftext($img, 25, 0, 620,510, $Black, $font1, $wv_max_);
imagettftext($img, 15, 0, 720,510, $Black, $font1, "m/s");
imagettftext($img, 15, 0, 770,510, $Black, $font1, "[" .$wv_max_time_ ."]");
imageline($img, 460,515,900,515, $Black);
imagettftext($img, 12, 0, 10,562, $Blue, $font1, "■降雨量");
imageline($img, 5,565,1050,565, $Blue2);
imagettftext($img, 15, 0, 10,610, $Black, $font1, "1時間:");
imagettftext($img, 25, 0, 200,610, $Black, $font1, $rain_1h_);
imagettftext($img, 15, 0, 320,610, $Black, $font1, "mm");
imageline($img, 10,615,400,615, $Black);
imagettftext($img, 15, 0, 460,610, $Black, $font1, "今月:");
imagettftext($img, 25, 0, 640,610, $Black, $font1, $rain_month_);
imagettftext($img, 15, 0, 780,610, $Black, $font1, "mm");
imageline($img, 460,615,900,615, $Black);
imagettftext($img, 15, 0, 10,660, $Black, $font1, "本日:");
imagettftext($img, 25, 0, 200,660, $Black, $font1, $rain_day_);
imagettftext($img, 15, 0, 320,660, $Black, $font1, "mm");
imageline($img, 10,665,400,665, $Black);
imagettftext($img, 15, 0, 460,660, $Black, $font1, "トータル:");
imagettftext($img, 25, 0, 640,660, $Black, $font1, $rain_all_);
imagettftext($img, 15, 0, 780,660, $Black, $font1, "mm");
imageline($img, 460,665,900,665, $Black);
*/
// ===============================================
// 描画した画像を保存 & パレットを削除
// 備考 :
// 更新 : 2010/09/08 KMK T.Teraoka
// ===============================================
header('Content-Type: image/png');
// imagepng($img, $imgFileName);
imagepng($img);
imagedestroy($img);
//===============================================
// HTML終了処理
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//===============================================
//print "</body>";
//print "</html>";
?>