好吧..所以我一直在嘗試爲我玩的遊戲製作'簽名'。 唯一的問題是,當我想插入一個Avatar &在線/離線圖像時,我遇到了很多問題。PHP GD:圖片無法顯示,因爲有錯誤
的兩件事情我一直試圖做的是:從網頁habplus.com/home/[username
獲取用戶狀態]通過檢查habbo_offline.gif存在。
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
我已經包括了全部源代碼,以及和頁面可以訪問here -Another與鏈接變量included
希望你能幫助.. 此致,馬爾莫克
<?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);
?>
我不太明白。我已經有了嗎? 你是在暗示我重複嗎? [Screenshot](http://d.pr/i/7RiA) – Malmoc
我告訴過你:只需在代碼中切換兩行。 –