<?php
// SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND
$testFont = '%путь_от_корня_системы%/mods/signature_generator/signatures/default/spaceage.ttf';
if (!file_exists($testFont)) {
die('The font specified cannot be found (' . $testFont .')! Please specify an existing font');
}
// create a true color image (requires GD2)
$image = ImageCreateTrueColor(600, 200);
ImageAlphaBlending($image, true);
// allocate some colors
$black = ImageColorAllocate($image, 0, 0, 0);
$red = ImageColorAllocate($image, 0xff, 0, 0);
$green = ImageColorAllocate($image, 0, 0xff, 0);
$blue = ImageColorAllocate($image, 0, 0, 0xff);
$white = ImageColorAllocate($image, 0xff, 0xff, 0xff);
// create a frame
ImageFilledRectangle($image, 0, 0, 599, 199, $white);
ImageRectangle($image, 0, 0, 599, 199, $black);
// output some text using the specified font
$y = 20;
$text = 'Your Freetype installation with GD works';
for ($i = 12; $i <= 20; $i++) {
$box = ImageTTFBbox($i, 0, $testFont, $text);
$x = 300 - (max($box[0], $box[2], $box[4], $box[6]) - min($box[0], $box[2], $box[4], $box[6])) / 2;
ImageTTFText($image, $i, 0, $x, $y, $black, $testFont, $text);
$y += max($box[1], $box[3], $box[5], $box[7]) - min($box[1], $box[3], $box[5], $box[7]);
}
// output the test image
header('Content-Type: image/png');
ImagePNG($image);
?>
где
%путь_от_корня_системы% у меня, например =
/var/www/test/html/kb/и для меня, полный будет вот такой:
/var/www/test/html/kb/mods/signature_generator/signatures/default/spaceage.ttfв итоге должен получить вот такую картинку:
ЗЫ.
Don't forget to delete the install folder now or restrict the access to it!
Сообщение отредактировал Doozer: 03 September 2008 - 0:19