作者共发了4篇帖子。 内容转换:不转换▼
 
点击 回复
333 3
GD庫輸出帶有字體的文字
一派护法 十九级
1楼 发表于:2015-6-13 10:03
<?php
header("Content-type:image/png");

$im = imagecreatetruecolor(550, 70);
$colour = imagecolorallocate($im, 224, 223, 238);
imagefill($im, 0, 0, $colour);

$fontfile = "/var/www/arslanbar/2/fonts/DejaVuSans.ttf" ;
$colour = imagecolorallocate($im, mt_rand(0, 100), mt_rand(50, 150), mt_rand(100, 200));
imagettftext($im, 35, 0, 4, 38, $colour, $fontfile, "Which is the best one?");

$fontfile = "/var/www/arslanbar/2/fonts/showg.ttf" ;
$colour = imagecolorallocate($im, mt_rand(0, 100), mt_rand(50, 150), mt_rand(100, 200));
imagettftext($im, 22, 0, 4, 65, $colour, $fontfile, "Do you think they are important?");

imagepng($im);
imagedestroy($im);
?>
一派护法 十九级
2楼 发表于:2015-6-13 10:04
無需打開字體文件,只需指定文件路徑。
一派护法 十九级
3楼 发表于:2015-6-13 10:05

文字顏色是隨機生成的!
一派护法 十九级
4楼 发表于:2015-6-13 10:05

回复帖子

内容:
用户名: 您目前是匿名发表
验证码:
(快捷键:Ctrl+Enter)
 

本帖信息

点击数:333 回复数:3
评论数: ?
作者:巨大八爪鱼
最后回复:巨大八爪鱼
最后回复时间:2015-6-13 10:05
 
©2010-2024 Arslanbar Ver2.0
除非另有声明,本站采用知识共享署名-相同方式共享 3.0 Unported许可协议进行许可。