2012-03-15 3 views
1
내가

기능은

<?PHP 
header('Content-Type: image/png'); 

$im = imagecreatetruecolor(320, 80); 

$blue = imagecolorallocate($im, 59, 89, 152); 
$sky = imagecolorallocate($im, 219, 241, 255); 

imagefilledrectangle($im, 0, 0, 399, 79, $sky); 

$font = 'arial.ttf'; 

$text = "Hello world"; 

imagettftext($im, 15, 0, 10, 20, $blue, $font, $text); 
imagepng($im); 
imagedestroy($im); 
?> 

은 이제 넣어 이미지를 다음과 같이 될 것입니다 다음 코드를 사용하여 특정 텍스트와 이미지를 만들 기꺼이

이 직사각형

rectangle image

이제 무엇 나는 아칸소 그것을 만든하려는 경우 PHP 매뉴얼을 참조하여 ounded 코너 약 function imagefilledrectangle 나는 기능과 좋은 의견이 코너

<? 

function ImageRectangleWithRoundedCorners(&$im, $x1, $y1, $x2, $y2, $radius, $color) 
{ 
// draw rectangle without corners 
imagefilledrectangle($im, $x1+$radius, $y1, $x2-$radius, $y2, $color); 
imagefilledrectangle($im, $x1, $y1+$radius, $x2, $y2-$radius, $color); 
// draw circled corners 
imagefilledellipse($im, $x1+$radius, $y1+$radius, $radius*2, $radius*2, $color); 
imagefilledellipse($im, $x2-$radius, $y1+$radius, $radius*2, $radius*2, $color); 
imagefilledellipse($im, $x1+$radius, $y2-$radius, $radius*2, $radius*2, $color); 
imagefilledellipse($im, $x2-$radius, $y2-$radius, $radius*2, $radius*2, $color); 
} 

?> 

둥근하지만 사용하는 방법을 언급하지 않았다 만들 수 있다고 발견했습니다! ~ anyhelp

+1

을 해보자? 당신은'$ radius' 매개 변수를 추가해야합니다. 여러분은 잘 가야합니다. –

+0

@Pekka 덕분에 가능한 경우 전체 코드로 답을 쓸 수 있습니다. ~ 시간 내 주셔서 감사합니다 –

답변

0

나 아마

$x1 = top left point's x coordinate 
$y1 = top left point's y coordinate 
$x2 = bottom right point's x coordinate 
$y2 = bottom right point's y coordinate 
$radius = radius of the curve of rounded corner 

설정이 데이터를 시도하고 ... 행운을 빕니다 :) 난 당신이 보통 하나의 장소에서 함수를 호출 할 가정

+0

작동하지 않습니다 :(, 나는 왜 그들이 반경과 경계 매개 변수를 제공 모르겠어요. –