GD로 테스트 출력
페이지 정보
작성자 서방님 댓글 0건 조회 132회 작성일 16-07-22 10:37본문
<?
// PHP - GD로 테스트 출력
function euckr2utf8($text) {
return stripslashes(iconv("EUC-KR","UTF-8",$text));
}
$fontname = "MALGUN.TTF";
$text = "안녕하세요";
$fontsize = 24;
$bound = ImageTTFBBox($fontsize,0,$fontname, euckr2utf8($text));
$imgWidth = $bound[2]+2;
$imgHeight = $fontsize*1.5;
$im=ImageCreate($imgWidth,$imgHeight);
$white = ImageColorAllocate ($im, 255, 255, 255);
$green = ImageColorAllocate ($im, 0, 0, 0);
ImageTTFText($im,$fontsize,0,0,$imgHeight-10,$green,$fontname, euckr2utf8($text));
Header ("Content-type: image/png"); // 헤더에 이미지 타입이라고 알려준다.
ImagePNG($im); // 클라이언트에게 이미지를 보낸다.
ImageDestroy($im);
?>
댓글목록
등록된 댓글이 없습니다.