F
Floris
Guest
Eric, I see you got inspired by my signature
Eric, I see you got inspired by my signature
Ah, but mine is special. Like my post and refresh the page.
Ah, but mine is special. Like my post and refresh the page.
give us the script!!!
give us the script!!!
Or make it dynamic so that we can plugin our details to the image URL (like username or ID)
<?php
// XenForo signature generator by Erik Swan :)
function getPage($url){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, 'XenForo Signature Generator by Eriksrocks');
curl_setopt($ch,CURLOPT_TIMEOUT,10);
$html=curl_exec($ch);
if($html==false){
$m=curl_error(($ch));
error_log($m);
}
curl_close($ch);
return $html;
}
$username = 'eriksrocks';
$userid = '103';
$page = getPage('http://xenforo.com/community/members/' . $username . '.' . $userid . '/mini-stats.xml');
$xml = simplexml_load_string($page);
$likes = $xml->total_likes;
$trophies = $xml->trophy_points;
// DEFINE STUFF
$font = 'square.ttf';
$size = 27;
$x1 = 45;
$x2 = 136;
$y = 43;
$width = 198;
$height = 76;
$kerning = 3;
// DRAW
$final = imagecreatefrompng("sigbackground.png");
$black = imagecolorallocate($final, 0, 0, 0);
imagealphablending($final, true); // setting alpha blending on
imagesavealpha($final, true); // save alphablending setting (important)
$array = str_split($likes);
$hpos = $x1;
for($i=0; $i<count($array); $i++)
{
$bbox = imagettftext( $final, $size, 0, $hpos, $y, $black, $font, $array[$i] );
$hpos = intval($bbox[2])+$kerning;
}
$array = str_split($trophies);
$hpos = $x2;
for($i=0; $i<count($array); $i++)
{
$bbox = imagettftext( $final, $size, 0, $hpos, $y, $black, $font, $array[$i] );
$hpos = intval($bbox[2])+$kerning;
}
// OUTPUT
header('Content-type: image/png');
imagepng($final);
imagedestroy($final);
?>
Good grief that's a lot of code to do something very simple... How about just fetching http://xenforo.com/community/members/kier.2/mini-stats.xml ?If I hosted this it would probably bring my shared hosting account to its knees pretty quickly. (I do have a VPS, but it's not ready for a production environment). Feel free to host it yourself though...
Good grief that's a lot of code to do something very simple... How about just fetching http://xenforo.com/community/members/kier.2/mini-stats.xml ?
sweet XML stuff.. should be the next Have you seen? forum feature to cover
Good grief that's a lot of code to do something very simple... How about just fetching http://xenforo.com/community/members/kier.2/mini-stats.xml ?
Excellent! For stuff like v3 Arcade it'd be nice to toss up the number of Arcade awards the member has into the results.I don't see why not.
How do I embed the code into my sig?
Oh, sorry, we probably should have explained it better. The XML is only XML - you have to use the script I posted above (hosted on your own server). The script fetches the XML and then uses the image library GD to make an image out of it.
Then all you do is add an image tag in your signature pointed to the script on your server.
yup... that works, and takes in an id now to make it look good
We use essential cookies to make this site work, and optional cookies to enhance your experience.