php imagesetthickness有什么用?
php imagesetthickness 用法
(php 4 >= 4.0.6, php 5, php 7)
imagesetthickness — 设定画线的宽度
说明
imagesetthickness ( resource $image , int $thickness ) : bool
imagesetthickness() 把画矩形,多边形,椭圆等等时所用的线宽设为 thickness 个像素。成功时返回 true, 或者在失败时返回 false。
note: 此函数需要 gd 2.0.1 或更高版本(推荐 2.0.28 及更高版本)。
参数
image
由图象创建函数(例如imagecreatetruecolor())返回的图象资源。
thickness
thickness, in pixels.
返回值
成功时返回 true, 或者在失败时返回 false。
范例
example #1 imagesetthickness() example
<?php// create a 200x100 image$im = imagecreatetruecolor(200, 100);$white = imagecolorallocate($im, 0xff, 0xff, 0xff);$black = imagecolorallocate($im, 0x00, 0x00, 0x00);// set the background to be whiteimagefilledrectangle($im, 0, 0, 299, 99, $white);// set the line thickness to 5imagesetthickness($im, 5);// draw the rectangleimagerectangle($im, 14, 14, 185, 85, $black);// output image to the browserheader('content-type: image/png');imagepng($im);imagedestroy($im);?>
以上例程的输出类似于:
更多相关技术文章,请访问!
