Mailinglisten-Archive |
Hallo Liste,
unter http://www.geocrawler.com/archives/3/1/1999/3/0/1367510/
hab ich Kristians Script jetzt gefunden.
Ich habe jetzt versucht, das mit dem Script zu verwursteln,
welches ich verwende. Das klappt soweit ganz gut. Die Gifs
werden im Cache-Verzeichnis angelegt.
Allerdings kommt ein neues Problem: Der Text wird nicht angezeigt
und auch die Bildgröße stimmt nicht. Es wird nur ein Mini-Bild
angezeigt.
Hier ist der Code:
<?php
Header(\"Content-type: image/gif\");
$cachepath = \"/home/www/cache\";
$hash = md5($label);
$hashpath = \"$cachepath/$hash.gif\";
if (file_exists($hashpath)) {
readfile($hashpath);
exit;
}
$fontfile = \"adler.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);
imagegif($img, $hashpath);
imagedestroy($img);
readfile($hashpath);
?>
Ich verstehs einfach nicht. Ich habe den Code von Kris genommen
und ihn IMHO logisch um meinen alten ergänzt.
TIA
Mark
php::bar PHP Wiki - Listenarchive