victoriala Posted January 8, 2009 Share Posted January 8, 2009 I'm this far: http://barrage.woelmuis.nl/signature.php This code I got so far (some readings from other topic): <?php $username = $_POST['zezima']; $username = strtolower(str_replace(' ', '_', $username)); $website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username); $stats = explode("\n", $website); $overall = array_shift(explode(",", $stats[0])); $stat['att'] = explode(",", $stats[1]); $stat['def'] = explode(",", $stats[2]); $stat['str'] = explode(",", $stats[3]); $stat['hp'] = explode(",", $stats[4]); $stat['rng'] = explode(",", $stats[5]); $stat['pry'] = explode(",", $stats[6]); $stat['mag'] = explode(",", $stats[7]); $stat['ck'] = explode(",", $stats[8]); $stat['wc'] = explode(",", $stats[9]); $stat['flt'] = explode(",", $stats[10]); $stat['fsh'] = explode(",", $stats[11]); $stat['fm'] = explode(",", $stats[12]); $stat['cra'] = explode(",", $stats[13]); $stat['smi'] = explode(",", $stats[14]); $stat['min'] = explode(",", $stats[15]); $stat['her'] = explode(",", $stats[16]); $stat['ag'] = explode(",", $stats[17]); $stat['th'] = explode(",", $stats[18]); $stat['sl'] = explode(",", $stats[19]); $stat['frm'] = explode(",", $stats[20]); $stat['rc'] = explode(",", $stats[21]); $stat['hun'] = explode(",", $stats[22]); $stat['cs'] = explode(",", $stats[23]); $image_link = 'signature_test.png'; $image = imagecreatefrompng($image_link); $font_colour = imagecolorallocate($image, 0, 0, 0); $font_size = 5; $x = array('28', '80', '135', '188', '240'); $y = array('8', '29', '52', '77', '100'); $i = '0'; $a = '0'; foreach($stat as $s_key => $value){ imagestring($image, $font_size, $x[$a], $y[$i], $value[1], $font_colour); $i++; if($i == '5'){ $i = '0'; $a++; } } imagestring($image, $font_size, '230', '82', 'overall:' . $overall, $font_colour); imagestring($image, $font_size, '240', '105', '' . $username, $font_colour); header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> Now my question.... It show overall: only to me, but I want to let it show the levels. Example: Code: [img=http://www.draynor.net/stat/mithril/male/archer_outfit/Zezima.png] So could anyone help me with my problem. ,Victoriala Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/ Share on other sites More sharing options...
victoriala Posted January 8, 2009 Author Share Posted January 8, 2009 bump.. Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732587 Share on other sites More sharing options...
premiso Posted January 8, 2009 Share Posted January 8, 2009 bump.. Seriously, wait at least an hour or two or until this is on the next page, not less than 15 minutes to bump. Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732594 Share on other sites More sharing options...
Brian W Posted January 8, 2009 Share Posted January 8, 2009 I went and grabbed a random players stats and they look like this: 1,2376,1265755220 372,99,52782714 7352,99,17168313 929,99,34358949 789,99,40235736 270,99,29537467 597,99,13626973 1741,99,18251131 16,99,200000000 15570,99,13357342 10,99,200000000 10202,99,13067574 7,99,200000000 2,99,200000000 1605,99,13107717 1402,99,13142023 5,99,52665024 1083,99,13185730 68,99,43702542 2440,99,13057084 156,99,19951064 97,99,22217059 3415,99,13329528 51,99,15723035 352,99,13288215 -1,-1 -1,-1 -1,-1 -1,-1 Very nifty output. Change: $overall = array_shift(explode(",", $stats[0])); to: $overall = explode(",", $stats[0]); For use $Rank = $overall[0]; $Level = $overall[1]; $XP = $overall[2]; Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732617 Share on other sites More sharing options...
victoriala Posted January 8, 2009 Author Share Posted January 8, 2009 Change: $overall = array_shift(explode(",", $stats[0])); to: $overall = explode(",", $stats[0]); I changed it but look: http://barrage.woelmuis.nl/signature.php For use $Rank = $overall[0]; $Level = $overall[1]; $XP = $overall[2]; Btw I wanted too look like this http://barrage.woelmuis.nl/signature2.php This I don't get (no explode?) Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732629 Share on other sites More sharing options...
victoriala Posted January 8, 2009 Author Share Posted January 8, 2009 http://barrage.woelmuis.nl/signature3.php The numbers is did by hand... (see code) + How do i make the letters/numbers white? <?php $username = $_POST['zezima']; $username = strtolower(str_replace(' ', '_', $username)); $website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username); $stats = explode("\n", $website); $overall = array_shift(explode(",", $stats[0])); $stat['att'] = explode(",", $stats[1]); $stat['def'] = explode(",", $stats[2]); $stat['str'] = explode(",", $stats[3]); $stat['hp'] = explode(",", $stats[4]); $stat['rng'] = explode(",", $stats[5]); $stat['pry'] = explode(",", $stats[6]); $stat['mag'] = explode(",", $stats[7]); $stat['ck'] = explode(",", $stats[8]); $stat['wc'] = explode(",", $stats[9]); $stat['flt'] = explode(",", $stats[10]); $stat['fsh'] = explode(",", $stats[11]); $stat['fm'] = explode(",", $stats[12]); $stat['cra'] = explode(",", $stats[13]); $stat['smi'] = explode(",", $stats[14]); $stat['min'] = explode(",", $stats[15]); $stat['her'] = explode(",", $stats[16]); $stat['ag'] = explode(",", $stats[17]); $stat['th'] = explode(",", $stats[18]); $stat['sl'] = explode(",", $stats[19]); $stat['frm'] = explode(",", $stats[20]); $stat['rc'] = explode(",", $stats[21]); $stat['hun'] = explode(",", $stats[22]); $stat['cs'] = explode(",", $stats[23]); $image_link = 'signature_test2.png'; $image = imagecreatefrompng($image_link); $font_colour = imagecolorallocate($image, 0, 0, 0); $font_size = 5; $x = array('28', '80', '135', '188', '240'); $y = array('8', '29', '52', '77', '100'); $i = '0'; $a = '0'; foreach($stat as $s_key => $value){ imagestring($image, $font_size, $x[$a], $y[$i], $value[1], $font_colour); $i++; if($i == '5'){ $i = '0'; $a++; } } imagestring($image, $font_size, '224', '72', '106' . $overall, $font_colour); imagestring($image, $font_size, '240', '105', '' . $username, $font_colour); imagestring($image, $font_size, '224', '84', '1786' . $overall, $font_colour); imagestring($image, $font_size, '240', '105', '' . $username, $font_colour); imagestring($image, $font_size, '211', '96', '67,148' . $overall, $font_colour); imagestring($image, $font_size, '240', '105', '' . $username, $font_colour); imagestring($image, $font_size, '203', '109', '53,373,559' . $overall, $font_colour); imagestring($image, $font_size, '240', '105', '' . $username, $font_colour); header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732639 Share on other sites More sharing options...
Brian W Posted January 8, 2009 Share Posted January 8, 2009 What is the output right now? no explode where? I see lots of explodes... I messed with you x cordinates a bit because all I had to work with is that file U put a link too. Sorry The username isn't displayed in the correct place either right now. Try: <?php $username = $_POST['zezima']; $username = strtolower(str_replace(' ', '_', $username)); $website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username); $stats = explode("\n", $website); $overall = explode(",", $stats[0]); $stat['att'] = explode(",", $stats[1]); $stat['def'] = explode(",", $stats[2]); $stat['str'] = explode(",", $stats[3]); $stat['hp'] = explode(",", $stats[4]); $stat['rng'] = explode(",", $stats[5]); $stat['pry'] = explode(",", $stats[6]); $stat['mag'] = explode(",", $stats[7]); $stat['ck'] = explode(",", $stats[8]); $stat['wc'] = explode(",", $stats[9]); $stat['flt'] = explode(",", $stats[10]); $stat['fsh'] = explode(",", $stats[11]); $stat['fm'] = explode(",", $stats[12]); $stat['cra'] = explode(",", $stats[13]); $stat['smi'] = explode(",", $stats[14]); $stat['min'] = explode(",", $stats[15]); $stat['her'] = explode(",", $stats[16]); $stat['ag'] = explode(",", $stats[17]); $stat['th'] = explode(",", $stats[18]); $stat['sl'] = explode(",", $stats[19]); $stat['frm'] = explode(",", $stats[20]); $stat['rc'] = explode(",", $stats[21]); $stat['hun'] = explode(",", $stats[22]); $stat['cs'] = explode(",", $stats[23]); $image_link = 'signature_test.png'; $image = imagecreatefrompng($image_link); $font_colour = imagecolorallocate($image, 0, 0, 0); $font_size = 5; $x = array('28', '72', '112', '155', '240'); $y = array('8', '29', '52', '77', '100'); $i = '0'; $a = '0'; foreach($stat as $s_key => $value){ imagestring($image, $font_size, $x[$a], $y[$i], $value[1], $font_colour); $i++; if($i == '5'){ $i = '0'; $a++; } } imagestring($image, $font_size, '210', '82', '' . $overall[1], $font_colour);//removed the "overall:" because it is already part of the image imagestring($image, $font_size, '240', '105', '' . $username, $font_colour);//the x cordinate is messed up header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732640 Share on other sites More sharing options...
Brian W Posted January 8, 2009 Share Posted January 8, 2009 White is 255, 255, 255 Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732642 Share on other sites More sharing options...
victoriala Posted January 8, 2009 Author Share Posted January 8, 2009 What is the output right now? no explode where? I see lots of explodes... I messed with you x cordinates a bit because all I had to work with is that file U put a link too. Sorry The username isn't displayed in the correct place either right now. Try: <?php $username = $_POST['zezima']; $username = strtolower(str_replace(' ', '_', $username)); $website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username); $stats = explode("\n", $website); $overall = explode(",", $stats[0]); $stat['att'] = explode(",", $stats[1]); $stat['def'] = explode(",", $stats[2]); $stat['str'] = explode(",", $stats[3]); $stat['hp'] = explode(",", $stats[4]); $stat['rng'] = explode(",", $stats[5]); $stat['pry'] = explode(",", $stats[6]); $stat['mag'] = explode(",", $stats[7]); $stat['ck'] = explode(",", $stats[8]); $stat['wc'] = explode(",", $stats[9]); $stat['flt'] = explode(",", $stats[10]); $stat['fsh'] = explode(",", $stats[11]); $stat['fm'] = explode(",", $stats[12]); $stat['cra'] = explode(",", $stats[13]); $stat['smi'] = explode(",", $stats[14]); $stat['min'] = explode(",", $stats[15]); $stat['her'] = explode(",", $stats[16]); $stat['ag'] = explode(",", $stats[17]); $stat['th'] = explode(",", $stats[18]); $stat['sl'] = explode(",", $stats[19]); $stat['frm'] = explode(",", $stats[20]); $stat['rc'] = explode(",", $stats[21]); $stat['hun'] = explode(",", $stats[22]); $stat['cs'] = explode(",", $stats[23]); $image_link = 'signature_test.png'; $image = imagecreatefrompng($image_link); $font_colour = imagecolorallocate($image, 0, 0, 0); $font_size = 5; $x = array('28', '72', '112', '155', '240'); $y = array('8', '29', '52', '77', '100'); $i = '0'; $a = '0'; foreach($stat as $s_key => $value){ imagestring($image, $font_size, $x[$a], $y[$i], $value[1], $font_colour); $i++; if($i == '5'){ $i = '0'; $a++; } } imagestring($image, $font_size, '210', '82', '' . $overall[1], $font_colour);//removed the "overall:" because it is already part of the image imagestring($image, $font_size, '240', '105', '' . $username, $font_colour);//the x cordinate is messed up header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> http://barrage.woelmuis.nl/signature.php http://barrage.woelmuis.nl/signature2.php If you see now it shows only the image Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732713 Share on other sites More sharing options...
Brian W Posted January 8, 2009 Share Posted January 8, 2009 Changed a lot of shit on this. <?php $username = $_POST['zezima']; $username = strtolower(str_replace(' ', '_', $username)); //$username = "Zezima"; $website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username); $stats = explode("\n", $website); $overall = explode(",", $stats[0]); $stat['att'] = explode(",", $stats[1]); $stat['def'] = explode(",", $stats[2]); $stat['str'] = explode(",", $stats[3]); $stat['hp'] = explode(",", $stats[4]); $stat['rng'] = explode(",", $stats[5]); $stat['pry'] = explode(",", $stats[6]); $stat['mag'] = explode(",", $stats[7]); $stat['ck'] = explode(",", $stats[8]); $stat['wc'] = explode(",", $stats[9]); $stat['flt'] = explode(",", $stats[10]); $stat['fsh'] = explode(",", $stats[11]); $stat['fm'] = explode(",", $stats[12]); $stat['cra'] = explode(",", $stats[13]); $stat['smi'] = explode(",", $stats[14]); $stat['min'] = explode(",", $stats[15]); $stat['her'] = explode(",", $stats[16]); $stat['ag'] = explode(",", $stats[17]); $stat['th'] = explode(",", $stats[18]); $stat['sl'] = explode(",", $stats[19]); $stat['frm'] = explode(",", $stats[20]); $stat['rc'] = explode(",", $stats[21]); $stat['hun'] = explode(",", $stats[22]); $stat['cs'] = explode(",", $stats[23]); $stat['sum'] = explode(",", $stats[24]);//You missed this one... Missed one $image_link = 'signature.png'; $image = imagecreatefrompng($image_link); $font_colour = imagecolorallocate($image, 255, 255, 255); $font_size = 5; $x = array('28', '72', '112', '155', '200', '240'); $y = array('8', '29', '52', '77', '100'); $i = '0'; $a = '0'; $row_len = 6; foreach($stat as $s_key => $value){ imagestring($image, $font_size, $x[$a], $y[$i], $value[1], $font_colour); //This was putting them in the wrong order //It was going down cols then restetting up and going down the next col. //Modified to go accross the row, reset back on next row down. $a++; if($i == 2){ $row_len = 4; } //after row 2, rows are only 4 long if($a == $row_len){ $a = '0'; $i++; } } $font_size = 3; imagestring($image, $font_size, '225', '85', $overall[1], $font_colour);//removed the "overall:" because it is already part of the image imagestring($image, $font_size, '225', '98', $overall[0], $font_colour);//Rank imagestring($image, $font_size, '225', '109', $overall[2], $font_colour);//XP $font_size = 8; //To get it bigger or change font, you'll need to research the library you are using imagestring($image, $font_size, '180', '50', '' . $username, $font_colour); header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> You'll need to respecify the imgage you are using because I changed it to simply $image_link = 'signature.png'; I really hope that works Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732750 Share on other sites More sharing options...
victoriala Posted January 8, 2009 Author Share Posted January 8, 2009 Still no data appears on the image. Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732882 Share on other sites More sharing options...
Brian W Posted January 8, 2009 Share Posted January 8, 2009 Do you have access to the PHP root directory? I think you are going about this wrong. $username = $_POST['zezima']; zezima did not become what $username equals. It is looking for what <input name="zezima" type="text"> sent over from a form. What you want is $username = $_GET['playername']; then, for the URL, pagename.php?playername=zezima Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732930 Share on other sites More sharing options...
Brian W Posted January 8, 2009 Share Posted January 8, 2009 I felt particularly interested in this project because I'd never messed with the image functions and I'm also creating an online RPG for fun. So, I've gone and finished the username output and got that latest update I told you with $_GET Latest version: <?php $username = $_GET['playername']; //zezima $username = strtolower(str_replace(' ', '_', $username)); $website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username); $stats = explode("\n", $website); $overall = explode(",", $stats[0]); $stat['att'] = explode(",", $stats[1]); $stat['def'] = explode(",", $stats[2]); $stat['str'] = explode(",", $stats[3]); $stat['hp'] = explode(",", $stats[4]); $stat['rng'] = explode(",", $stats[5]); $stat['pry'] = explode(",", $stats[6]); $stat['mag'] = explode(",", $stats[7]); $stat['ck'] = explode(",", $stats[8]); $stat['wc'] = explode(",", $stats[9]); $stat['flt'] = explode(",", $stats[10]); $stat['fsh'] = explode(",", $stats[11]); $stat['fm'] = explode(",", $stats[12]); $stat['cra'] = explode(",", $stats[13]); $stat['smi'] = explode(",", $stats[14]); $stat['min'] = explode(",", $stats[15]); $stat['her'] = explode(",", $stats[16]); $stat['ag'] = explode(",", $stats[17]); $stat['th'] = explode(",", $stats[18]); $stat['sl'] = explode(",", $stats[19]); $stat['frm'] = explode(",", $stats[20]); $stat['rc'] = explode(",", $stats[21]); $stat['hun'] = explode(",", $stats[22]); $stat['cs'] = explode(",", $stats[23]); $stat['sum'] = explode(",", $stats[24]);//You missed this one... Missed one $image_link = 'signature.png'; $image = imagecreatefrompng($image_link); $font_colour = imagecolorallocate($image, 255, 255, 255); $font_size = 5; $x = array('28', '72', '112', '155', '200', '240'); $y = array('8', '29', '52', '77', '100'); $i = '0'; $a = '0'; $row_len = 6; foreach($stat as $s_key => $value){ imagestring($image, $font_size, $x[$a], $y[$i], $value[1], $font_colour); //This was putting them in the wrong order //It was going down cols then restetting up and going down the next col. //Modified to go accross the row, reset back on next row down. $a++; if($i == 2){ $row_len = 4; } //after row 2, rows are only 4 long if($a == $row_len){ $a = '0'; $i++; } } $font_size = 3; imagestring($image, $font_size, '225', '73', "IDK", $font_colour);//Combat imagestring($image, $font_size, '225', '85', $overall[1], $font_colour);//Overall imagestring($image, $font_size, '225', '98', $overall[0], $font_colour);//Rank imagestring($image, $font_size, '225', '109', $overall[2], $font_colour);//XP $font_size = 8; //To get it bigger or change font, you'll need to research the library you are using //imagestring($image, $font_size, '180', '50', '' . $username, $font_colour); imagettftext($image, 18, 0, 180, 72, $font_colour, 'arial.ttf', ucwords($username)); header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> you may need to change the line $image_link = 'signature.png'; The font specified in imagettftext($image, 18, 0, 180, 72, $font_colour, 'arial.ttf', ucwords($username)); can be changed, but you'll need to be sure that the font exists on the server. Trial and error possibly... Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-732947 Share on other sites More sharing options...
victoriala Posted January 9, 2009 Author Share Posted January 9, 2009 Won't work I used 1 old now and changed POST to GET, result still nothing. So I leave it by this.. Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-733397 Share on other sites More sharing options...
DarkSuperHero Posted January 9, 2009 Share Posted January 9, 2009 does your host have gd enabled? try enabling error reporting to E_ALL Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-733407 Share on other sites More sharing options...
Brian W Posted January 9, 2009 Share Posted January 9, 2009 if the image is even getting output, the GD library must be present. Victoriala, are you testing this local or is there a place I can go and look at what you have being output? Also, did you try what I posted last with the URL ending in "?playername=zezima" ? ? ? Quote Link to comment https://forums.phpfreaks.com/topic/140020-runescape-stat-signature-help-requested/#findComment-733445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.