imagefontwidth 函數(shù)接受一個(gè)包含字體的單個(gè)參數(shù) $font。對(duì)于內(nèi)置字體,它可以是1、2、3、4、5。對(duì)于自定義字體,它可以與imageloadfont() 一起使用。
$font = imageloadfont('Pacifico.ttf');
echo 'Font width for Pacifico is '. imagefontwidth($font);
$font = imageloadfont('Pacifico.ttf');
echo 'Font width for Pacifico is '. imagefontwidth($font);
2021-10-18
使驗(yàn)證碼的字符無(wú)序:
$charSet = array_merge(range(0, 9), range('A', 'Z'), range('a', 'z'));
shuffle($charSet);
$code = implode(array_slice($charSet, 0, 4));
$charSet = array_merge(range(0, 9), range('A', 'Z'), range('a', 'z'));
shuffle($charSet);
$code = implode(array_slice($charSet, 0, 4));
2019-05-12
保證圓弧繪制在圖像中:
$cx = mt_rand(0, $width);
$cy = mt_rand(0, $height);
$w = mt_rand(0, min($cx, $width - $cx));
$h = mt_rand(0, min($cy, $height - $cy));
$s = mt_rand(0, 360);
$e = mt_rand(0, 360);
imagearc($image, $cx, $cy, $w, $h, $s, $e, $color);
$cx = mt_rand(0, $width);
$cy = mt_rand(0, $height);
$w = mt_rand(0, min($cx, $width - $cx));
$h = mt_rand(0, min($cy, $height - $cy));
$s = mt_rand(0, 360);
$e = mt_rand(0, 360);
imagearc($image, $cx, $cy, $w, $h, $s, $e, $color);
2019-05-12
繪制圓弧
imagearc(圖像, 圓心橫坐標(biāo), 圓心縱坐標(biāo), 圓的寬度, 圓的高度, 起點(diǎn)角度, 終點(diǎn)角度, 顏色);
起點(diǎn)角度、終點(diǎn)角度:正數(shù)表示順時(shí)針,負(fù)數(shù)表示逆時(shí)針
imagearc(圖像, 圓心橫坐標(biāo), 圓心縱坐標(biāo), 圓的寬度, 圓的高度, 起點(diǎn)角度, 終點(diǎn)角度, 顏色);
起點(diǎn)角度、終點(diǎn)角度:正數(shù)表示順時(shí)針,負(fù)數(shù)表示逆時(shí)針
2019-05-12