PHP生成IP地址图片的代码

<?php
$img_number = imagecreate(275,25);
$backcolor = imagecolorallocate($img_number,102,102,153);
$textcolor = imagecolorallocate($img_number,255,255,255);

imagefill($img_number,0,0,$backcolor);
$number = ” Your IP is $_SERVER[REMOTE_ADDR]”;

Imagestring($img_number,10,5,5,$number,$textcolor);

header(“Content-type: image/jpeg”);
imagejpeg($img_number);
?>

<?php
Header(“Content-type: image/PNG”);
$im = imagecreate(150,20);//生成IP图片
$white = ImageColorAllocate($im, 255,255,255); //背景颜色
$color = imagecolorallocate($im, 255, 180, 37); //文字颜色
imagefill($im,0,0,$white);
imagestring($im,5,2,2,”[“.$_SERVER[“REMOTE_ADDR”].”]”,$color);
ImagePNG($im);
ImageDestroy($im);
?>

发表评论

你必须 登录 才能发表评论.