로딩
요청 처리 중입니다...

이미지에 텍스트 넣기

 이미지에 텍스트 넣기

이미지 중앙에 텍스트를 넣는 함수. 함수를 사용하면 지정한 이미지 중앙에 텍스트를 넣어 신규 파일로 생성해준다.

$txt = "이미지 중앙에 텍스트 넣기"; $img = "./test1.jpg"; writeImgTxt($txt, $img, ".

/test2.jpg"); function writeImgTxt($str, $srcFile, $destFile){ $fFile = "./gulim.ttc"; $fontsize = 13; //이미지 사이즈 $iSize = getimagesize($srcFile); $iWidth = $iSize[0]; $iHeight = $iSize[1]; $im = imagecreatefromjpeg($srcFile); $fColor = imagecolorallocate($im, 0, 0, 0); //텍스트 가운데 정렬해서 쓰기 $strsize = imageftbbox($fontsize, 0, $fFile, $str, array("linespacing" => 1)...

# imagettftext # php # 이미지에텍스트넣기