大家好,我刚让我的端口检查器处理动态图像,但是如果服务器离线,会出现严重错误,有什么帮助吗?
这是它所说的:图像太小:http: //3nerds1site.com/test/finalimage.php ?ip=blacknscape.no-ip.biz&port=80
这是它应该看起来的样子,但只有在它在线时才有效?
但无论如何继承我的代码我不相信它的代码问题也许我的网络主机是hostgator?
<?php
$ip = $_GET["ip"];
$port = $_GET["port"];
$online = "Online";
$offline = "Offline";
$status = fsockopen($ip, $port) ? $online : $offline;
// Create a blank image and add some text
$im = imagecreatetruecolor(215, 86);
$text_color = imagecolorallocate($im, 233, 14, 91);
// sets background to Light Blue
$LightBlue = imagecolorallocate($im, 95, 172, 230);
imagefill($im, 0, 0, $LightBlue);
//Server Information
imagestring($im, 7, 5, 5, '3Nerds1Site.com', $text_color);
imagestring($im, 2, 40, 30, $ip, $text_color);
imagestring($im, 2, 40, 40, $port, $text_color);
imagestring($im, 2, 40, 70, $status, $text_color);
// Set the content type header - in this case image/jpeg
header('Content-Type: image/png');
// Output the image
imagepng($im);
// Free up memory
imagedestroy($im);
?>