Mailinglisten-Archive |
Hallo,
wer spendiert mir ein funktionieres Bsp mit imagettfbbox
das unter php mod_php4-4.0.6 läuft ?
Habe schon viele, nicht funktionierende Bsp's aus Listen und
von google, zum Beispiel:
<?
Header("Content-Type: image/png");
$im = ImageCreateFrompng('bild.png');
$str = "Hello World";
$font = "/home/gerlach/web/buzo/times.ttf";
$bbox = imagettfbbox(40,0,$font, $str);
$black = ImageColorAllocate($im,128,128,128);
$start_x = ImageSX($im)/2 - (($bbox[0] + $bbox[2] + $bbox[4] + $bbox[6]) / 4);
$start_y = ImageSY($im)/2 - (($bbox[1] + $bbox[3] + $bbox[5] + $bbox[7]) / 4);
$white = ImageColorAllocate($im,255,255,255);
$red = ImageColorAllocate($im,255,0,0);
ImageLine($im,0,0,200,200,$red);
$gray = ImageColorAllocate($im,196,196,196);
ImageTTFText($im, 40, 0, $start_x+3, $start_y-3, $black, $font, $str);
ImageTTFText($im, 40, 0, $start_x,$start_y, $gray, $font, $str);
Imagepng($im);
ImageDestroy($im);
?>
Die Fehler sind immer so viele und so merkwürdig, daß ich
damit nicht anfangen möchte.
Übringens: das Erzeugen eines Bildes mit:
<?php
Header( "Content-type: image/png");
$im = imagecreate(200,200);
$blue = ImageColorAllocate($im,0x2c,0x6D,0xAF);
ImageFilledRectangle($im,0,0,200,100,$blue);
$white = ImageColorAllocate($im, 255,255,255);
imagestring($im, 5, 20, 20, "TEst",$white);
Imagepng($im);
ImageDestroy($im);
?>
funktioniert prächtig. Die GD-lib ist also funktionstüchtig.
thx
Ekkard
php::bar PHP Wiki - Listenarchive