Live Stats Signature
#1

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?
Reply
#2

We can't help without actually seeing your code.
Reply
#3

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(); 

?>
Reply
#4

Try using a different font file. Maybe that one is corrupted? Have you tried using multiple fonts with no luck?
Reply
#5

Yes. I've tried many fonts but the result is the same.
What about the actual image? Why does it change like that?
Reply
#6

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.
Reply
#7

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..
Reply
#8

Where are you getting the font files from?
Reply
#9

From here: http://www.dafont.com/slant.font
Why is that relevant? I thought that only the format matters.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)