Mailinglisten-Archive |
Hallo Liste,
ich beabsichtige dynamische Buttons per GD Libary zu erzeugen. Leider
funktioniert folgender Code nicht. D.H. Ergibt mit statt einem
definierten Text in der ImageTTFBBox() lediglich ein etwa 5x5 rotes
Pixel aus:
Weiss da jemand Rat?
<?php
header("Content-type: image/png");
$text = urldecode( implode($argv,"hallo"));
$fontfile = "ARIALN.TTF";
$fontsize = 22;
$fontangle = 0;
$dimtxt = ImageTTFBBox( $fontsize, $fontangle, $fontfile, $text );
$border = 2;
$txtsizex = abs($dimtxt[4] - $dimtxt[0]);
$txtsizey = abs($dimtxt[5] - $dimtxt[1]);
$imgsizex = $txtsizex + 3*$border;
$imgsizey = $txtsizey + 5*$border;
$txtposx = $border;
$txtposy = $txtsizey + $border;
$img = imageCreate( $imgsizex, $imgsizey);
$col1 = imagecolorallocate( $img, 153, 0, 51);
$col2 = imagecolorallocate( $img, 255, 255, 255);
imagefill( $img, 0, 0, $col1);
imageTTFText( $img, $fontsize, $fontangle, $txtposx, $txtposy, $col2,
$fontfile, $text );
/* imagecolortransparent( $img, $col1); */
imagepng( $img );
imagedestroy( $img );
?>
Danke und Gruss
--
** Durchgehend geöffnet: http://www.php-center.de **
Die PHP-Liste: mailto:php_(at)_php-center.de
http://infosoc.uni-koeln.de/mailman/listinfo/php
php::bar PHP Wiki - Listenarchive