Mailinglisten-Archive |
Im folgenden Script wird komischerweise die Schrift von oben nach unten
dargestellt + spiegelverkehrt. Weiss jemand um Rat oder liegt das an der
GD Version?
DAnke für Eure Hilfe!!!
GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with TTF library
PNG Support enabled
<?php
Header("Content-type: image/png");
$font = "timesk8.ttf";
# Set default label
if (!isset($text)) $text = "Button";
# Set default fontsize
if (!isset($fontsize)) $fontsize=20;
# Get dimensions of text in specified font size.
$size = imagettfbbox($fontsize,0,$font, $text);
$text_width = abs($size[2] - $size[0]);
$font_height = abs($size[5] - $size[3]);
$xpad = 300;
$ypad = 300;
# Create an image big enough for the text and the padding.
$im=imagecreate(($font_width + $xpad),($font_height + $ypad));
# Allocate colors
$blue = ImageColorAllocate($im, 0x2c, 0x60, 0xAF);
$black = ImageColorAllocate($im, 0, 0, 0);
$white = ImageColorAllocate($im, 255, 255, 255);
#ImageFilledRectangle($im, 0, 0, 199, 99, $white);
ImageRectangle($im, 0, 0, ($font_width+$xpad-1), ($font_height+$ypad-1),
$black);
ImageRectangle($im, 0, 0, ($font_width+$xpad), ($font_height+$ypad),
$white);
ImageTTFText($im, $fontsize, 0, (int)($xpad/2)+1,
$font_height+(int)($ypad/2), $black, $font, $text);
ImageTTFText($im, $fontsize, 0, (int)($xpad/2),
$font_height+(int)($ypad/2)-1, $white, $font, $text);
ImagePng($im);
ImageDestroy($im);
?>
php::bar PHP Wiki - Listenarchive