Код: Выделить всё
define('WIDTH', 800);
define('HEIGHT', 600);
$font="./cms/font/impact.ttf";
$image = imagecreatetruecolor(WIDTH,HEIGHT)
or die('Cannot create image');
if (getGlobal('WIFI.Online')=="1") {
imagettftext($image,20,0,370,50,0x00FF00,"$font",'Точка доступа "WI-FI" включена');
}else{
imagettftext($image,20,0,370,50,0xff3030,"$font",'Точка доступа "WI-FI" выключена');
}
imagettftext($image,36,0,50,510,0xFFFFFF,"$font","Дома ".getGlobal('Corridor.Temperature').'°C, влажность '.getGlobal('Kitchen.Humidity').'%.');
imagettftext($image,36,0,50,450,0xFFFFFF,"$font",getGlobal('yw_fact.temperature').'°C, '.getGlobal('yw_fact.weather_type').'.');
if (gg('Alarm00.AlarmTime') == gg('ThisComputer.timeNow')) { // Будильник 00
$alarmmsg=gg('Alarm00.AlarmSay');
$alarm="1";
$alarmname="Будильник ".gg('Alarm00.AlarmName');
}elseif (gg('Alarm01.AlarmTime') == gg('ThisComputer.timeNow')) {// Будильник 01
$alarmmsg=gg('Alarm01.AlarmSay');
$alarm="1";
$alarmname="Будильник ".gg('Alarm01.AlarmName');
}elseif (gg('Alarm02.AlarmTime') == gg('ThisComputer.timeNow')) {// Будильник 02
$alarmmsg=gg('Alarm02.AlarmSay');
$alarm="1";
$alarmname="Будильник ".gg('Alarm02.AlarmName');
}else{ //Иначе часы
$alarmmsg=gg('ThisComputer.timeNow');
$alarm="0";
$alarmname=gg('ThisComputer.Day');
}
if ($alarm =="1") { //Если будильник то
$sizefont="24";
$colorfont="0xffa500";
$WIDTHMSG="50";
$HEIGHTMSG="300";
$sizefont1="24";
$colorfont1="0xffa500";
$WIDTHMSG1="50";
$HEIGHTMSG1="250";
}else{ //Если будильника нет
$sizefont="124";
$colorfont="0xffa500";
$WIDTHMSG="220";
$HEIGHTMSG="350";
$sizefont1="44";
$colorfont1="0xffa500";
$WIDTHMSG1="220";
$HEIGHTMSG1="200";
}
if (gg('ThisComputer.NewVideoMessages') > 0) {
$alarmname="Новых видео сообщений: ".gg('ThisComputer.NewVideoMessages');
$sizefont1="34";
$colorfont1="0xffa500";
$WIDTHMSG1="130";
$HEIGHTMSG1="200";
}
if (gg('global.on') > 0) {
if (gg('global.title')) {
$alarmname=gg('global.title');
$sizefont1="34";
$colorfont1="0xffa500";
$WIDTHMSG1="50";
$HEIGHTMSG1="200";
}
}
imagettftext($image,$sizefont,0,$WIDTHMSG,$HEIGHTMSG,$colorfont,"$font",$alarmmsg);
imagettftext($image,$sizefont1,0,$WIDTHMSG1,$HEIGHTMSG1,$colorfont,"$font",$alarmname);
$res='';
if (gg('Security.stateColor')=='green' && gg('System.stateColor')=='green' && gg('Communication.stateColor')=='green') {
$res='Все системы работают в штатном режиме';
$colorstat="0x00FF00";
} else {
if (gg('Security.stateColor')!='green') {
$colorstat="0xff3030";
$res.=" Проблема безопасности: ".getGlobal('Security.stateDetails');
}
if (gg('System.stateColor')!='green') {
$res.=" Системная проблема: ".getGlobal('System.stateDetails');
$colorstat="0xff3030";
}
if (gg('Communication.stateColor')!='green') {
$res.=" Проблема связи: ".getGlobal('Communication.stateDetails');
$colorstat="0xff3030";
}
}
if (gg('reg_2.level') == "0") $colortlevel="0x008b00";
if (gg('reg_2.level') == "1") $colortlevel="0x008b00";
if (gg('reg_2.level') == "2") $colortlevel="0xc0ff3e";
if (gg('reg_2.level') == "3") $colortlevel="0xcaff70";
if (gg('reg_2.level') == "4") $colortlevel="0xfff68f";
if (gg('reg_2.level') == "5") $colortlevel="0xffff00";
if (gg('reg_2.level') == "6") $colortlevel="0xff8247";
if (gg('reg_2.level') == "7") $colortlevel="0xff3030";
if (gg('reg_2.level') == "8") $colortlevel="0xcd2626";
if (gg('reg_2.level') == "9") $colortlevel="0x8b1a1a";
if (gg('reg_2.level') == "10") $colortlevel="0x8b1a1a";
imagettftext($image,30,0,50,60,0x0099FF,"$font",'USD: '.gg('cbr.USD'));
imagettftext($image,30,0,50,100,0x0099FF,"$font",'EURO: '.gg('cbr.EURO'));
imagettftext($image,20,0,50,580,$colorstat,"$font",gg('ThisComputer.somebodyHomeText'));
imagettftext($image,20,0,50,550,$colorstat,"$font",$res);
imagettftext($image,32,0,575,100,$colortlevel,"$font",'Пробки: '.gg('reg_2.level'));
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);