код вставки изображения
Собственно,есть мониторинг сервера контры,он встроен в изображение.
Суть моей ситуации такая.Хочу в мониторинг добавить строку,что выводил ещё карты игры из какой-то дирриктории.Изображения в формате .jpg.
Пробовал сам,но без результатно...
Вот ещё не знаю в какой файл пхп всовывать строку...
Однин файл:
PHP код:
<?
require_once("class_PQ.php");
$height=80;
$width=300;
$path="C:/xampp/htdocs/cs/mon1/"; // путь до картинки))
$image="cs.png";
Header("Content-type: image/png");
$im=imagecreatefrompng($path.$image);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
imageFill($im, 0, 0, $white);
$pqinfo = array();
$pq = PQ::create(array('ip' => "10.3.145.2:27015", 'querytype' => "halflife_new_queries",));
$pqinfo = $pq->query(array('players','info', 'rules'));
ImageString($im, 2, 120, 10, $pqinfo['name'], $black);
ImageString($im, 2, 120, 25, "IP: ".$pqinfo['ip'].":".$pqinfo['int_port'], $black);
ImageString($im, 2, 120, 40, "Map: ".$pqinfo['map'], $black);
ImageString($im, 2, 120, 55, "Player: ".$pqinfo['totalplayers']."/".$pqinfo['maxplayers'], $black);
ImageRectangle($im, 0, 0, $width-1, $height-1, $black);
Imagejpeg($im);
ImageDestroy($im);
?>
И ещё один:
PHP код:
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
/********
Main PsychoQuery Factory class. This returns a new PQ object based on the type of server you intend to query.
This is the only file you need to 'include' into your applications. The PQ directory must be somewhere in your
'include_path'.
Example:
include("class_PQ.php");
$pq = PQ::create($conf);
print_r($pq->query_info('10.3.145.2:27015'));
********/
if (defined("CLASS_PQ_PHP")) return 1;
define("CLASS_PQ_PHP", 1);
include_once("PQ/PQ_PARENT.php");
class PQ {
// Our factory method to create a valid object for our querytype specified
function &create($conf) {
if (!is_array($conf)) { // force $conf into an array.
$ip = $conf; // If $conf is not an array it's assumed to be an ipaddr[:port]
$conf = array( 'ip' => $ip );
unset($ip);
}
// Add defaults to the config. Defaults do not override values passed in the $conf array
$conf += array(
'ip' => '',
'port' => '',
'querytype' => 'halflife',
'master' => 0,
'timeout' => 3,
'retries' => 1,
);
// Separate IP:Port if needed
if (strpos($conf['ip'], ':') !== FALSE) {
$ipport = $conf['ip'];
list($conf['ip'], $conf['port']) = explode(':', $ipport, 2);
if (!is_numeric($conf['port'])) {
$conf['port'] = '';
}
} else {
$conf['port'] = ''; // default to no port (will be determined later in the query process)
}
// If no 'querytype' is specified default to 'halflife'
if (!$conf['querytype']) {
$conf['querytype'] = 'halflife';
}
// Attempt to load the proper class for our specified 'querytype'.
$filename = strtolower($conf['querytype']);
$class = "PQ_" . $filename;
if (!include_once("PQ/" . $filename . ".php")) {
trigger_error("Unsupported 'querytype' specified (${conf['querytype']}) for new PQ object", E_USER_ERROR);
} else {
return new $class($conf);
}
}
} // end of class PQ
Но это не все,есть ещё папка PQ.
Но там видимо только выполняется считывание инфы,я так думаю...
Если не достаточно объяснил ситуацию,извеняйте.
|