好的..所以我一直在尝试为我玩的游戏制作“签名”。唯一的问题是,我在想要插入头像和在线/离线图像时遇到了很多问题。
我一直在尝试做的两件事是:
通过检查 habbo_offline.gif 是否存在,从网页 habplus.com/home/[username] 获取用户状态。
if(strpos(file_get_contents('http://www.habpl.us/home/'.$username.''), 'habbo_offline.gif') == true) {
抓取用户图像并显示在最终图像上
function habSigFigure($username){ $omgfig = 'http://www.habpl.us/figure.php?user='.$username.'&img_format=gif'; return $omgfig; //place habbo avatar $habsigfig = imagecreatefromgif($omgfig); imagecopy($img, $habsigfig, 13, 32, 0, 0, imagesx($habsigfig), imagesy($habsigfig));*/ //place habbo avatar
我已经包含了整个源代码,并且可以在此处访问页面 -包含 变量的另一个链接
希望你能提供帮助..真诚的,马尔莫克
<?php
include 'config.php';
$username=$_REQUEST["user"];
$grabstat3 = fopen("http://habplus.com/fansitetools/userStats.php?user={$username}&stat=motto", "r");
while (!feof($grabstat3)){ $motto1 = fgets($grabstat3);
}
fclose($grabstat3);
$username=$_REQUEST["user"];
$grabstat2 = fopen("http://habplus.com/fansitetools/userStats.php?user={$username}&stat=pixels", "r");
while (!feof($grabstat2)){ $pixels1 = fgets($grabstat2);
}
fclose($grabstat2);
$username=$_REQUEST["user"];
$grabstat1 = fopen("http://habplus.com/fansitetools/userStats.php?user={$username}&stat=credits", "r");
while (!feof($grabstat1)){ $credits1 = fgets($grabstat1);
}
fclose($grabstat1);
$pixels = 'Pixels: '.$pixels1.'';
$credits = 'Credits: '.$credits1.'';
$motto = 'Motto: '.$motto1.'';
/* Get custom img */
if(empty($_REQUEST['img'])){
$img = 'default.png';
}else{
$img =$_REQUEST['img'];
}
/* TEXT COLORS */
$red =$_REQUEST['red'];
$green =$_REQUEST['green'];
$blue =$_REQUEST['blue'];
/* Font size */
$fsize =$_REQUEST['fsize'];
/*function habSigStatus($username){
if(strpos(file_get_contents('http://www.habpl.us/home/'.$username.''), 'habbo_offline.gif') == true){
return false;
}else{
return true;
function habSigFigure($username){
$omgfig = 'http://www.habpl.us/figure.php?user='.$username.'&img_format=gif';
return $omgfig;
}
}
}*/
/*
//place habbo avatar
$habsigfig = imagecreatefromgif($omgfig);
imagecopy($img, $habsigfig, 13, 32, 0, 0, imagesx($habsigfig), imagesy($habsigfig));*/
//place habbo avatar
//habbo status
if(strpos(file_get_contents('http://www.habpl.us/home/'.$username.''), 'habbo_offline.gif') == true){
$status_img = imagecreatefromgif('habbo_offline.gif');
}else{
$status_img = imagecreatefromgif('habbo_online.gif');
}
imagecopy($image, $status_img, 403, 96, 0, 0, 50, 16);
//habbo status
$image = imagecreatefrompng($img);
$font_color = imagecolorallocate($image, $red, $green, $blue);
imagefttext($image, $fsize, 0, 3, 12, $font_color, './volt.ttf', $credits); /* top left */
imagefttext($image, $fsize, 0, 403, 12, $font_color, './volt.ttf', $pixels); /* top right */
imagefttext($image, $fsize, 0, 3, 96, $font_color, './volt.ttf', $motto); /* bottom left */
imagefttext($image, $fsize, 0, 403, 96, $font_color, './volt.ttf', $online); /* bottom right */
/* imagefttext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text [, array $extrainfo]) */
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>