如何使用gd库获取矩形的边框半径

时间:2013-10-10 11:14:03

标签: php image gd

我正在使用gd库代码来创建一个矩形。我怎样才能在php中获得矩形的边框半径。

以下是我的代码:

    $bg_color="5465FF";
$text_color="61FF66";
$button_width = 150;
$button_height =50;
$textdisplay="text";

$r_bg = hexdec("0x".substr($bg_color,0,2));
$g_bg = hexdec("0x".substr($bg_color,2,2));
$b_bg = hexdec("0x".substr($bg_color,4,2));

$r_bgt = hexdec("0x".substr($text_color,0,2));
$g_bgt = hexdec("0x".substr($text_color,2,2));
$b_bgt = hexdec("0x".substr($text_color,4,2));
header('content-type: image/png');      
$image = imagecreate($button_width, $button_height); 
$blue = imagecolorallocate($image, $r_bg, $g_bg, $b_bg); 
$red = imagecolorallocate($image, $r_bgt, $g_bgt, $b_bgt);  
imagestring($image,18,0,0,$textdisplay,$red);       
imagepng($image);
imagedestroy($image);

我希望我的矩形看起来像这样:

1 个答案:

答案 0 :(得分:0)

border-radius : 10px;(也许 - 试试这个)