PHP - GD 그림과 텍스트 합치기

<?
 // 그림과 텍스트 합치기
 header ("Content-type: image/png");

 $fontname = "MALGUN.TTF";
    $width = "500";
    $height = "500";

    $im=ImageCreate($width,$height);  // 이미지의 크기를 정합니다.
    $im2 = imagecreatefromjpeg("kim.jpg"); //imagecreatefromgif

    $white = ImageColorAllocate ($im, 255, 255, 255);// 사용할 색상 설정 
    $gray = ImageColorAllocate($im,0,0,0);  // 사용할 색상 설정

    ImageCopyMerge ($im, $im2, 0, 0, 0, 0, 500,500,50);
    ImageRectangle($im,0,0,500,500, $gray);
    ImageTTFText($im2,20,0,5,128,$gray,$fontname,"PHP for GD...");
    ImagePNG($im2);
    ImageDestroy($im); // 이미지에 사용한 메모리 제거
?>

댓글