PHP imagesetthickness有什么用

PHPz
풀어 주다: 2020-09-04 17:11:07
원래의
1312명이 탐색했습니다.

PHP imagesetthickness用于设定画线的宽度,可以把画矩形,多边形,椭圆等等时所用的线宽设为指定像素大小;语法“imagesetthickness(image,thickness)”,thickness用于指定线宽(像素)。

PHP imagesetthickness有什么用

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 white
imagefilledrectangle($im, 0, 0, 299, 99, $white);
// Set the line thickness to 5
imagesetthickness($im, 5);
// Draw the rectangle
imagerectangle($im, 14, 14, 185, 85, $black);
// Output image to the browser
header(&#39;Content-Type: image/png&#39;);
imagepng($im);
imagedestroy($im);
?>
로그인 후 복사

以上例程的输出类似于:

企业微信截图_15924508105039.png

更多相关技术文章,请访问PHP中文网

관련 라벨:
php
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!