• [Source] Steam Signature SteamProfile clone
    73 replies, posted
Any chance I could use your star image?
[QUOTE=andersonmat;23975336]This is what I started. Never finished it though: [img]http://z-dev.org/prj/sb/?id=andersonmat&l[/img][/QUOTE] Oh cool, would be nice if you could release it.
[QUOTE=andersonmat;23975336]This is what I started. Never finished it though: [img]http://z-dev.org/prj/sb/?id=andersonmat&l[/img][/QUOTE] Finish it! :D
Source to sig.php: [code] <?php //You should not touch anything in here, everything you need is in the config.php file. require_once("config.php"); $userid = friendid($_GET['id']); if (!is_numeric($userid)){ //Must be the community ID since that is what we give it from index.php.. don't let the foolish mortals bypass it! die("No bypassing :)"); } $work = TRUE; //$work = FALSE; //FALSE means do the intensive code //TRUE means do the cached file $filename = ''.$cachfolder.'/'.$userid.'.png'; if (file_exists($filename)){ if (time() > filemtime($filename) + $cachetime) { $work = FALSE; } }else{ $work = FALSE; } if($work){ $filename = ''.$cachfolder.'/'.$userid.'.png'; $imgs = imagecreatefrompng($filename); header("Content-type: image/png"); imagepng($imgs); imagedestroy($imgs); }else{ $filedata = grabdata("http://steamcommunity.com/profiles/".$userid."?xml=1"); $dom = simplexml_load_string($filedata); if ($dom->error){ die(); } $file = $background_image; $imgs = imagecreatefrompng($file); if($dom->privacyState != 'public') { $bstatus = imagecreatefrompng($offline_image); $tcolor = imagecolorallocate($imgs,137,137,137); $statustext = "Private Profile"; }else if($dom->onlineState == "in-game") { //Person is in Game $bstatus = imagecreatefrompng($ingame_image); $tcolor = imagecolorallocate($imgs,127,177,62); $gametext = $dom->inGameInfo->gameName; $statustext = 'In-Game: '.$gametext; if (strlen($statustext) > 34) { $statustext = substr($statustext, 0, 34); $statustext = $statustext."..."; } }else if($dom->onlineState == 'online'){ //Person is online $bstatus = imagecreatefrompng($online_image); $tcolor = imagecolorallocate($imgs,142,202,254); $statustext = "Online"; }else{ $statustext = $dom->onlineState; //Person is offline $bstatus = imagecreatefrompng($offline_image); $tcolor = imagecolorallocate($imgs,137,137,137); } $font1 = "DejaVuSans.ttf"; if ($dom->vacBanned == 0){ $vac = imagecreatefrompng($vac_image); imagecopy($imgs, $vac, 48, 30, 0, 0, 16, 15); } $rating = $dom->steamRating; if ($dom->steamRating){ $ratingimg = imagecreatefrompng($steam_image); imagecopy($imgs, $ratingimg, 68, 30, 0, 0, 16, 16); imagettftext($imgs, 7, 0, 78, 34, $tcolor, $font1, 'X'.$rating); } $profilei = imagecreatefromjpeg($dom->avatarIcon); imagecopy($imgs, $bstatus, 4, 4, 0, 0, 40, 40); imagecopy($imgs, $profilei, 8, 8, 0, 0, 32, 32); $name = $dom->steamID; $text = $name; $font = "DejaVuSans-Bold.ttf"; imagettftext($imgs, 7, 0, 48, 14, $tcolor, $font, $text); imagettftext($imgs, 7, 0, 48, 25, $tcolor, $font1, $statustext); //imagettftext($imgs, 7, 0, 48, 37, $tcolor, $font1, $gametext); header("Content-type: image/png"); imagepng($imgs, "cache/$userid.png", 0); imagepng($imgs); imagedestroy($imgs); } [/code] Source to config.php: [code] <?php //This is the config file for variables to be used in other parts of the script. //Enter the URL and the folder in which this config file is in. $websiteurl = "http://killersservers.co.uk/sig/"; //Cache folder must reside inside of the /sig/ folder, so //using the default "cache" would make the cache folder /sig/cache $cachfolder = "cache"; //Contents in the cache folder can be deleted any time, it will not ruin the script or the user end. //If you change this, you need to change the folder name cache. //cache time in seconds. To prevent long cache periods set to 1 second. //default: 300 seconds = 5 minutes $cachetime = 300; //Cache Time means, a persons photo will update every 5 minutes as long as someone views it. //so that if the person keeps refreshing the image, or going to a forum it wont waist //your servers bandwidth. // //Basic stuff // $online_image = "images/online.png"; $offline_image = "images/offline.png"; $ingame_image ="images/game.png"; $background_image = "images/background.png"; $vac_image = 'images/vac.png'; $steam_image = 'images/star.png'; // // // // // // // // // //Do not touch any of this stuff unless you are l33t haxor function friendid($id) { if(strpos(strtolower($id), 'team_')) { $steamid = $id; //STEAM_X:Y:Z $x = (int)substr($steamid, 6, 1); $y = (int)substr($steamid, 8, 1); $z = (int)substr($steamid, 10); //Let X,Y, and Z be defined by the Steam ID: STEAM_X:Y:Z //Let W be defined by the Steam Community ID: steamcommunity.com/profiles/W //<math>W = (Z \times 2) + 76561197960265728 + Y\,</math> $z2 = $z * 2; $z3 = $z2 + 7960265728; $z4 = $z3 + $y; //$result = array($x, $y, $z, $w, $z2, $z3, $z4); debug return "7656119".$z4; } else { return $id; } } function grabdata($url){ $data = file_get_contents($url); $content = html_entity_decode($data); return $content; } ?> [/code] You can use my images if you really want to but they are horrible. Edit: I now have an awesome star and tick. Tick when you are not VAC banned, red cross when you are.
P.s. my code is far superior and it caches images. :v: [editline]02:16PM[/editline] /elitism [editline]02:17PM[/editline] And yes, I'll finish the other one.
[QUOTE=andersonmat;23990366]P.s. my code is far superior and it caches images. :v: [editline]02:16PM[/editline] /elitism [editline]02:17PM[/editline] And yes, I'll finish the other one.[/QUOTE] Sure post your code and I'll learn from it then. This one caches the final image too :v:
[QUOTE=LiquidGame;23990530]Sure[b],[/b] post your code and [b]I'll[/b] learn from it then. This one caches the final image [b]too[/b] :v:[/QUOTE] :eng101: [editline]03:06PM[/editline] "Grammar douchebag" QQ
[img]http://ugleh.com/sig/76561197994125006.png[/img] Nice.
[QUOTE=LiquidGame;23983282]Source to sig.php: ...code...[/QUOTE] You should use readfile() instead of this (at the cache part): [code]$filename = ''.$cachfolder.'/'.$userid.'.png'; $imgs = imagecreatefrompng($filename); header("Content-type: image/png"); imagepng($imgs); imagedestroy($imgs);[/code] No point in opening and closing the image. So: [code]$filename = $cachfolder . '/' . $userid . '.png'; header("Content-type: image/png"); readfile($filename); exit;[/code]
Thanks, this is mostly Uglehs stuff though. I updated mine a bit.
Just thought I'd bump this back - I've been working on my own version of this as you can see below: [img]http://www.peoplethatgame.com/76561197984484429.png[/img] I'm using LiquidGame's version - but I changed it a bit. It's using a longer version of the [url=http://www.steamprofile.com/]Steam Profile[/url] Signature Background. I have more features planned(such as customizing the theme/placement of things), and I'll be greatly appreciative if someone can make me or get me the large Online/Offline/In-Game Avatar borders like Steam Profile has.
sweet ;3 thank you! Also i'm find bug when user plya Counter-Strike, Half-Life or other game that use "-" in title image generetes with just one first part of game title. Replace this: [code]$a = '/<br \/>(.+?)]]><\/stateMessage>/'; preg_match($a,$filedata,$z); $gametext = $z[1]; $pieces = explode("-", $gametext); $gametext = $pieces[0]; $statustext = "In-game"; }else if( stristr($filedata, "<onlineState>online") == TRUE){ //Person is online[/code] With this: [code]$a = '/<br \/>(.+?)]]><\/stateMessage>/'; preg_match($a,$filedata,$z); $gametext = $z[1]; $pieces = explode(" - ", $gametext); $gametext = $pieces[0]; $statustext = "In-game"; }else if( stristr($filedata, "<onlineState>online") == TRUE){ //Person is online[/code] Also mb i have this error when rename In-game into russian (&#1042; &#1080;&#1075;&#1088;&#1077;) without "-" > [url=http://hl2.com.ua/sig/]check this[/url] <
hi [IMG]http://ugleh.com/sig/76561197993452571.png[/IMG]
Sorry, you need to Log In to post a reply to this thread.