Live Stats Signature -
[rG]Cold - 25.09.2014
Hey!
So i've recently tried to create a Live Stats Signature system.
It works but it has few bugs,such as..
the signature looks like :
instead of this:
And when i'm trying a new font the image wont show!
What is the problem?
Re: Live Stats Signature -
Abagail - 25.09.2014
We can't help without actually seeing your code.
Re: Live Stats Signature -
[rG]Cold - 25.09.2014
Sure..
Код:
<?php
error_reporting(E_ALL);
$player_name=$_GET['name'];
@mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database. Be sure the databasename exists and online is.");
$player_name = stripslashes($player_name);
$player_name = mysql_real_escape_string($player_name);
$query="SELECT * FROM playerdata WHERE name='$player_name'";
$result=mysql_query($query);
$i=mysql_num_rows($result);
if ($i == 1)
{
$Playername=mysql_result($result,0,"name");
$Money=mysql_result($result,0,"money");
$Score=mysql_result($result,0,"score");
header('Content-Type: image/png;');
$im = @imagecreatefrompng('img/signature.png') or die("Cannot select the correct image. Please contact the webmaster.");
$text_color = imagecolorallocate($im, 0,0,0);
$text_username = "$Playername";
$text_money = "$Money";
$text_score = "$Score";
//$font = 'SLANT.ttf';
imagestring($im, 5, 170, 37, $text_username, $text_color);
imagestring($im, 5, 165, 69, $text_money, $text_color);
imagestring($im, 5, 165, 99, $text_score,$text_color);
imagepng($im);
imagedestroy($im);
} else echo('Username is not in our database. Please try again.');
mysql_close();
?>
Re: Live Stats Signature -
Abagail - 25.09.2014
Try using a different font file. Maybe that one is corrupted? Have you tried using multiple fonts with no luck?
Re: Live Stats Signature -
[rG]Cold - 25.09.2014
Yes. I've tried many fonts but the result is the same.
What about the actual image? Why does it change like that?
Re: Live Stats Signature -
Abagail - 25.09.2014
I could be wrong about this, but maybe it's the wrong format of file causing everything to mess up the image.
http://php.net/manual/en/function.imagettftext.php might help you out better than I can. Just try reading that, and see if it helps.
Re: Live Stats Signature -
[rG]Cold - 25.09.2014
It's a .png format of the file,i don't see how that would mess up with the image,and that didn't help me alot..
Re: Live Stats Signature -
Abagail - 25.09.2014
Where are you getting the font files from?
Re: Live Stats Signature -
[rG]Cold - 25.09.2014
From here:
http://www.dafont.com/slant.font
Why is that relevant? I thought that only the format matters.
Re: Live Stats Signature -
Dotayuri - 25.09.2014
http://php.net/manual/en/function.mysql-result.php
I could update the code, but I would have to create a tutorial of my own. and I'm a little busy right now I probably won't get started on to tonight.