Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > PHP: Графика > Текстура в тексте


Автор: PoMKA 1.4.2009, 16:39
Доброго времени суток. Нашёл скриптик http://www.phpbuilder.com/columns/cash20030526.php3?page=5. Не могу осуществить...
У кого получилось?
Вот ещё по идеи скриптик, который осуществляет тоже самое:
Код

$img = ImageCreateTrueColor  (902,91);
//$black = imagecolorallocate($img,0,0,0);
//$white = imagecolorallocate($img,255,255,255);
$texture = imagecreatefrompng("../im/tile.png");
imagettftexttexture( $img, $texture, 70,0, 5,80, "../fonts/arial.ttf", "AaBbCcDdEeFfGgHhIiJjKk");

function imagettftexttexture(&$im,&$textureim,$size,$angle,$x,$y,$fontfile,$text) {
    $width = imagesx($im); // Get the width of the image
    $height = imagesy($im); // Get the height of the image
    $buffer = imagecreate($width,$height); // Create the buffer image
    imagesettile($buffer,$textureim);
    $pink = imagecolorclosest($im,255,0,255); // Create magic pink, a color commonly used for masks
    $trans = imagecolortransparent($im,$pink); // Make magic pink the transparent color
    imagettftext($im,$size,$angle,$x,$y,-$pink,$fontfile,$text); // Draw text over magic pink without aliasing
    imagecopy($buffer,$im,0,0,0,0,$width,$height); // Copy the main image onto the buffer
    imagecopy($im,$buffer,0,0,0,0,$width,$height); // Copy the buffer back onto the main image
    imagedestroy($buffer); // Destroy the buffer
}

Header ("Content-Type: Image/PNG");
imagepng($img);
imagedestroy($img);
imagedestroy($texture);

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)