GD로 테스트 출력 > php

본문 바로가기
사이트 내 전체검색

php

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);
?>

댓글목록

등록된 댓글이 없습니다.

Total 612건 16 페이지
게시물 검색

회원로그인

접속자집계

오늘
140
어제
163
최대
1,347
전체
154,674
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.