Hi all
i am having a small problem with my dynamic output code to produce a signature in php
the signature comes out fine with text but when i add another .png image to add ontop of the main signature i get a black background when i would like it transpearent to show like a users avatar.

my current code to output the signature:

header('Content-Type: image/png');  
    $im = @imagecreatefrompng('sigs/1.png') or die("Cannot select the correct image. Please contact the webmaster."); 
    $text_color = imagecolorallocate($im, 197,197,199); 
	$text_color_red = imagecolorallocate($im, 247,34,6);
    $text_username = "$username";
	$text_mypoints = "Points: ".numberFormat($mypoints)."";
	$text_mypoints1 = usersmypoints($id);
	$text_membertitle = "Member:";
	$text_totalposts = "Total Posts:";
	$text_totalposts_value = totalposts($id);
	$text_url = "http://";
	$outer = "../images/ranks/$tmp.png";
	$src = @imagecreatefrompng($outer);
    $font = 'sigs/arial.ttf'; 
	imagettftext($im, 8, 0, 171, 30, $text_color, $font, $text_membertitle); 
    imagettftext($im, 12, 0, 216, 30, $text_color, $font, $text_username); 
	imagettftext($im, 8, 0, 160, 47, $text_color, $font, $text_totalposts);
	imagettftext($im, 12, 0, 216, 47, $text_color, $font, $text_totalposts_value); 
	imagettftext($im, 7, 0, 15, 72, $text_color, $font, $text_url);   
    imagettftext($im, 10, 0, 10, 95, $text_color_red, $font, $text_mypoints); 
	imagettftext($im, 10, 0, 320, 95, $text_color, $font, $text_mypoints1);
	imagecopymerge($im, $src, 287, 20, 0, 0, 75, 71, 100);
	
    imagepng($im); 
    imagedestroy($im);

the below is the inner image on top of the main generated image

$outer = "../images/ranks/$tmp.png";
	$src = @imagecreatefrompng($outer);

i would like this to show in transparency

thankz

Recommended Answers

All 4 Replies

thanks for your reply
but this did not work it still shows a black background on the png image
i have changed the $png into $im being the refrence of the signature.

supplied screenshot of problem
screenshot of issue

fixed thanks for your input i had to do the following

$outer = "../images/ranks/1.png";
	$src = imagecreatefrompng($outer);
	imagesavealpha($src, true);
	imagealphablending($src, true);

then to display it

imagecopy($im, $src, 0, 0, 0, 0, 75, 71);

instead of

imagecopymerge($im, $src, 287, 20, 0, 0, 75, 71, 100);

thanks to you, bye.

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.