php imagettftext()函数使用TrueType字体将给定文本写入图像。
句法
PHP imagettftext()函数具有以下语法。
array imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text )
参数
- image - 图像资源。
- size - 字体大小。
- angle - 以度为单位的角度,0度为从左到右读取文本。
- x - x和y给出的坐标将定义第一个字符的基点。
- y - 纵坐标。
- color - 颜色索引。
- fontfile - TrueType字体的路径。
实例
<?php
/*
http://www.manongjc.com/article/1759.html
作者:码农教程
*/
$image = imagecreate(400,300);
$blue = imagecolorallocate($image, 0, 0, 255);
$white = ImageColorAllocate($image, 255,255,255);
imagettftext($image, 44, 15, 50, 200, $white,\"ARIAL\", \"java2s.com\");
// Set the content-type
header(\"content-type: image/png\");
imagepng($image);
imagedestroy($image);
?>
继续阅读与本文标签相同的文章
下一篇 :
php basename()函数
-
Python语言值不值得学习 有没有什么好的规划
2026-05-15栏目: 教程
-
vivo获最佳手机品牌!大数据背后的温情服务才是真理!
2026-05-15栏目: 教程
-
五大趋势助力塑造未来容器安全
2026-05-15栏目: 教程
-
如何入门Java编程行业 自学Java能参考哪些书
2026-05-15栏目: 教程
-
自主研发高性能边缘端AI芯片在杭州发布
2026-05-15栏目: 教程
