PHP GD Text Transparency..
Posted
by Deagle
on Stack Overflow
See other posts from Stack Overflow
or by Deagle
Published on 2010-03-24T23:21:31Z
Indexed on
2010/03/24
23:23 UTC
Read the original article
Hit count: 682
Hello,
I can't slove this. I'm trying to make a text transparency but doesn't work.. Here how it looks: qshort.com/userbar/gd.php
Here how if possible to show with transparency: qshort.com/userbar/transparent.png
Is that possible? Here my PHP Code:
<?php
header('Content-type: image/png');
$im = imagecreatefrompng("signature.png");
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 114, 114, 114);
$black = imagecolorallocate($im, 0, 0, 0);
$tr = imagecolorallocatealpha($im, 255, 255, 255, 20);
$trg = imagecolorallocatealpha($im, 114, 114, 114, 50);
$font = 'TCCB.TTF';
$mtext="Money: $0";
$mx="261";
$my="80";
$ms="16";
imagettftext($im, $ms, 0, $mx+1, $my, $grey, $font, $mtext);
imagettftext($im, $ms, 0, $mx-1, $my, $grey, $font, $mtext);
imagettftext($im, $ms, 0, $mx, $my+1, $grey, $font, $mtext);
imagettftext($im, $ms, 0, $mx, $my-1, $grey, $font, $mtext);
imagettftext($im, $ms, 0, $mx, $my, $white, $font, $mtext);
$atext="Score: 0";
$ax="261";
$ay="100";
$as="16";
imagettftext($im, $as, 0, $ax+1, $ay, $grey, $font, $atext);
imagettftext($im, $as, 0, $ax-1, $ay, $grey, $font, $atext);
imagettftext($im, $as, 0, $ax, $ay+1, $grey, $font, $atext);
imagettftext($im, $as, 0, $ax, $ay-1, $grey, $font, $atext);
imagettftext($im, $as, 0, $ax, $ay, $white, $font, $atext);
$ctext="Properties: 0";
$cx="261";
$cy="120";
$cs="16";
imagettftext($im, $cs, 0, $cx+1, $cy, $grey, $font, $ctext);
imagettftext($im, $cs, 0, $cx-1, $cy, $grey, $font, $ctext);
imagettftext($im, $cs, 0, $cx, $cy+1, $grey, $font, $ctext);
imagettftext($im, $cs, 0, $cx, $cy-1, $grey, $font, $ctext);
imagettftext($im, $cs, 0, $cx, $cy, $white, $font, $ctext);
$ntext="Nickname";
$nx="20";
$ny="45";
$ns="35";
imagettftext($im, $ns, 0, $nx+1, $ny, $trg, $font, $ntext);
imagettftext($im, $ns, 0, $nx-1, $ny, $trg, $font, $ntext);
imagettftext($im, $ns, 0, $nx, $ny+1, $trg, $font, $ntext);
imagettftext($im, $ns, 0, $nx, $ny-1, $trg, $font, $ntext);
imagettftext($im, $ns, 0, $nx, $ny, $tr, $font, $ntext);
imagepng($im);
imagedestroy($im);
?>
Thanks, Waiting for answer.
© Stack Overflow or respective owner