1
A
回答
3
下面的代码为你工作一定要donwload ARIAL.TTF和发生在目录
<?php
$fontsize = 36;
$fonttext = "test"." ";
$size = imagettfbbox($fontsize, 0, "arial.ttf", $fonttext);
$xsize = abs($size[0]) + abs($size[2]);
$ysize = abs($size[5]) + abs($size[1]);
$image = imagecreate($xsize, $ysize);
$black = imagecolorallocate($image, 0, 0, 0);
imagecolortransparent($image, $black);
$blue = imagecolorallocate($image, 0, 0, 255);
//$white = ImageColorAllocate($image, 255,255,255);
imagettftext($image, $fontsize, 0, abs($size[0]), abs($size[5]), $blue, "arial.ttf", $fonttext);
$bordercolors = imagecolorallocate($image, 255, 0, 0);
$x = 0;
$y = 0;
$w = $xsize - 1; //get width image and decrease 1px or points ?
$h = $ysize - 1; //get height image and decrease 1px or points ?
imageline($image, $x,$y,$x,$y+$h,$bordercolors); //left
imageline($image, $x,$y,$x+$w,$y,$bordercolors); //top
imageline($image, $x+$w,$y,$x+$w,$y+$h,$bordercolors); //right
imageline($image, $x,$y+$h,$x+$w,$y+$h,$bordercolors);
header('Content-Type: image/gif');
imagegif($image);
imagedestroy($image);
?>
大部分的代码是自我解释。
相关问题
- 1. 添加边框和颜色的JavaScript
- 2. 红色文本框边框颜色
- 3. 改变文本框的边框颜色
- 4. 添加左侧边框颜色编程
- 5. 如何用matplotlib为烛台添加边框或边缘颜色?
- 6. 如何在UITableviewCustomCell中为文本字段添加边框颜色 - iPhone
- 7. 在TextView中为文本添加颜色
- 8. 为颜色添加颜色
- 9. python networkX为特定边添加颜色
- 10. 边框颜色
- 11. 边框颜色
- 12. 文本框的边框颜色为现场使用CSS
- 13. 更改文本框边框颜色和电子邮件验证@
- 14. Webkit边框颜色文本颜色错误
- 15. 底部边框颜色使用文本颜色
- 16. 在输入文本的文本框更改边框颜色
- 17. 根据值为文本框添加颜色
- 18. 如何在opencv中为图像添加边框,边框颜色必须与图像颜色相同
- 19. 如何为`a`元素添加边框颜色动画?
- 20. 添加边框颜色和圆角到CGMutableRefPath
- 21. 将颜色背景和边框半径添加到布局
- 22. 将CSS边框颜色设置为文字颜色
- 23. in indesign javascript。如何选择文本框中的一些文本,并在第一次为文本框和颜色文本和背景添加颜色
- 24. CSS - 在剪辑路径多边形上添加边框颜色
- 25. 行边框颜色
- 26. LinkLabel边框颜色
- 27. ListView边框颜色
- 28. NSView边框颜色
- 29. 输入文本顶部和左边框有不同的边框颜色
- 30. 在Chrome中,添加边框半径也会添加背景颜色。为什么?
'' - 其余的由你决定。 –
imagettftext()让您指定一个ttf字体...您可以使用颜色更改和偏移调用它两次,以获得简单的阴影,该示例位于该函数的手册页上。 – Ben