|
Confirmed User
Join Date: Dec 2002
Posts: 109
|
Code:
<?
header("Content-Type: image/png");
function ImageStringAlignAndWrap($image, $font, $text, $color, $maxwidth) {
global $lines;
$fontwidth=6;
if ($maxwidth != NULL) {
$maxcharsperline = floor($maxwidth / $fontwidth);
$text = wordwrap($text, $maxcharsperline, "\n", 1);
}
$lines = explode("\n", $text);
}
if (isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif (isset($_SERVER['HTTP_VIA'])) {
$ip = $_SERVER['HTTP_VIA'];
}
else {
$ip = "unknown";
}
if ($ip hahahaha "unknown") {
$hst = "";
}
else {
$hst = @gethostbyaddr($ip);
$ispstr = explode( ".", $hst );
$numele = count( $ispstr );
$isp = "";
if ( $numele > 2 ) {
$isp = " Your ISP is " . $ispstr[$numele-2] . "." . $ispstr[$numele-1];
$isp .= "!";
}
if ( strstr($isp, "aol.com") ) $isp .= " (AOL sucks!)";
elseif ( strstr($isp, "msn.net") ) $isp .= " (Butterflies are ghey!)";
}
$agent = $HTTP_USER_AGENT;
if ( strstr($agent, "Mac") ) $os = "You are running on a Mac";
elseif ( strstr($agent, "Win98") ) $os = "You are running on Windows 98";
elseif ( strstr($agent, "NT 4") ) $os = "You are running on Windows NT";
elseif ( strstr($agent, "NT 5.0") ) $os = "You are running on Windows 2000";
elseif ( strstr($agent, "NT 5.1") ) $os = "You are running on Windows XP";
elseif ( strstr($agent, "Win") ) $os = "You are running on Windows";
elseif ( strstr($agent, "Linux") ) $os = "You are running on Linux";
else $os = "";
if ( strstr($agent, "MSIE 5") ) $browser = "using IE 5";
elseif ( strstr($agent, "MSIE 6") ) $browser = "using IE 6";
elseif ( strstr($agent, "MSIE 4") ) $browser = "using IE 4";
elseif ( strstr($agent, "Mozilla/5") ) $browser = "using Mozilla/Netscape 5";
elseif ( strstr($agent, "Mozilla/6") ) $browser = "using Netscape 6";
elseif ( strstr($agent, "Mozilla/4") ) $browser = "using Netscape 4";
elseif ( strstr($agent, "Chimera") ) $browser = "using Chimera";
else $browser = "";
if ( $os != "" && $browser != "" ) $browser = "\n$os and $browser!";
elseif ( $os != "" ) $browser = "\nYou are $os!";
$string = "You are $ip!$isp$browser";
$matrix = array(
"There is no spoon.",
"You have a problem with authority, Mr. Anderson.",
"What is 'real'? How do you define 'real'?",
"I know kung fu.",
"No, I am a meat popsicle.",
"So tell me my man, are you nervous in the service?",
"And I have way too much free time on my hands.",
"Spandex: it's a privilege, not a right.",
"I don't play well with others.",
);
$rand_string = $matrix[rand(0,8)];
$string .= "\n$rand_string";
$fontfile = "TECHNICN.TTF";
$fontsize = "10";
$textangle = "0";
ImageStringAlignAndWrap( $myimage, 3, $string, $black, 490 );
$numlines = count($lines);
$sigwidth = 1; $maxheight=1;
while (list($numl, $line) = each($lines)) {
list($pos_blx, $pos_bly, $pos_brx, $pos_bry, $pos_trx, $pos_try, $pos_tlx, $pos_tly) = imagettfbbox($fontsize, $textangle, $fontfile, $line);
$textwidth = $pos_brx - $pos_blx;
$textheight = $pos_bly - $pos_tly;
if ( $textwidth > $sigwidth ) $sigwidth = $textwidth;
if ( $textheight > $maxheight ) $maxheight = $textheight;
}
reset($lines);
$sigheight = ($numlines * $maxheight) + ($numlines * 3) + 4;
if ( $sigwidth < 50 ) $sigwidth = 50;
$picwidth = $sigwidth+20;
$picheight = $sigheight+44;
$myimage = ImageCreate($picwidth, $picheight);
$guy = ImageCreateFromPng('toughguy.png');
$top = ImageCreateFromPng('top.png');
$fill = ImageCreateFromPng('fill.png');
$black = ImageColorAllocate($myimage, 0, 0, 0);
$red = ImageColorAllocate($myimage, 255, 0, 0);
ImageFilledRectangle($myimage, 0, 0, $picwidth, 3, $red);
ImageFilledRectangle($myimage, 0, ($sigheight + 8), $picwidth, $picheight, $red);
ImageCopy( $myimage, $fill, 2, 6, 0, 0, ($sigwidth+16), $sigheight );
ImageCopy( $myimage, $guy, floor($sigwidth/2), ($sigheight + 8), 0, 0, 33, 36 );
ImageCopy( $myimage, $top, floor($sigwidth/2), 0, 0, 0, 38, 4 );
ImageColorTransparent($myimage, $red);
$y = 20;
while (list($numl, $line) = each($lines)) {
list($pos_blx, $pos_bly, $pos_brx, $pos_bry, $pos_trx, $pos_try, $pos_tlx, $pos_tly) = imagettfbbox($fontsize, $textangle, $fontfile, $line);
$textwidth = $pos_brx - $pos_blx;
$start_x = ($picwidth - $textwidth) / 2;
imagettftext($myimage, $fontsize, $textangle, $start_x, $y, $black, "TECHNICN.TTF", $line);
$y += ($maxheight + 3);
}
ImagePng($myimage);
ImageDestroy($myimage);
?>
__________________
SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60.
|