hi all

i have created a dynamic signature for a project i am working on
it is working fine but i would like to also pull the users avatar as well to show inside the dynamic signature.

my current dynamic code

<?php  
include("../system/uploadconnection.php");
include("../functions.php");


$username = $_GET['username']; // This gets the player his name from the previous page. 

/* Next, we will make a connection to the mysql.  
If it can't connect, it'll print on the screen: Unable to select database. Be sure the databasename exists and online is. */  


/* To protect MySQL injection. */ 
$username = stripslashes($username); 
$username = mysql_real_escape_string($username); 



$query="SELECT * FROM users WHERE username='$username'"; // Gets all the information about the player. 
$result=mysql_query($query); 
$i=mysql_num_rows($result); // Here we are counting how many rows this result gives us. 

/* We will now put the player's information into variables so we can use them more easily. */ 
/* DON'T FORGET: The names should be exact the same as in your mysql db.*/ 

if ($i == 1) // If the user has been correct, then it'll give us 1 row. If its 1 row, then it'll proceed with the code. 
{ 
         
    $username=mysql_result($result,0,"username"); // Gets the username of the player and put it in the variable $Playername. 
	$mypoints=mysql_result($result,0,"mypoints");
	$id=mysql_result($result,0,"id");
    //$Money=mysql_result($result,0,"Money"); // Gets the money of the player and put it in the variable $Money. 
   // $Score=mysql_result($result,0,"Score"); // Gets the score of the player and put it in the variable $Score. 


    // Creating of the .png image. 
	header('Content-Type: image/png;');  
    $im = @imagecreatefrompng('sigs/1.png') or die("Cannot select the correct image. Please contact the webmaster."); // Don't forget to put your picture there.
    $text_color = imagecolorallocate($im, 197,197,199); // RED, GREEN, BLUE --> Go to www.colorpicker.com, select a nice color. Copy the R/G/B letters provided by colorpicker and put them here. 
    $text_username = "$username"; // This gets the information about player name to be showed in the picture. 
	$text_mypoints = "Points: ".numberFormat($mypoints)."";
	$text_mypoints1 = usersrankiconlarge($id);
   // $text_score = "$Score"; // Same as above ^^ 
   // $text_money = "$Money"; // Same as above ^^ 
    $font = 'sigs/arial.ttf'; //Upload your custum font to the directory where this file is placed. Then change the name here. 
    /* USAGE OF THE imagettftext: First ($im) shouldn't be changed. (16) is the text-size. (0) is the angle of your text. Change it, and you'll see what's going on. (20) is de X-coordinate of the text. 
    (36) is the Y-coordinate of the text. */ 
    imagettftext($im, 12, 0, 160, 26, $text_color, $font, $text_username); // Prints the username in the picture.  
    imagettftext($im, 14, 10, 20, 63, $text_color, $font, $text_mypoints); // Prints the score in the picture. 
   // imagettftext($im, 16, 0, 72, 99, $text_color, $font, $text_money); // Prints the money in the picture. 
    imagepng($im); 
    imagedestroy($im); 
} else echo('Username is not in our database. Please try again.'); // If the username doesn't exist (so the row is 0) then it'll give en error. 

mysql_close(); 

?>

so within the image i would call a function which is "usersrankiconlarge" the function is working

but it is shoing the full image url on the dynamic sig instead of the image itself.

help would be greatful

Cheers

SOLVED:

i just needed to add:

$src = @imagecreatefrompng('locationtoimage.png');

then

imagecopymerge($im, $src, 287, 20, 0, 0, 75, 71, 100);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.