PHP로 문자를 그림으로 만드는 것

3251 단어 PHP
그런 게 좀 필요해.(WEBGL에서 일본어 글꼴을 사용할 수 없음...)
방문im.php?str=こんにちは,世界 후 쉼표 구분자로 줄을 바꾸어 이런 이미지를 생성합니다.
<?php
if( isset($_GET["str"]) ){
    $points = explode(",",$_GET["str"]);
}else{
    $str = ["Hello","World"];
}

$im = imagecreatetruecolor(400,600);
imagefilledrectangle($im, 0, 0, 599, 399, 0x101010);
$font = '/font/NotoSansCJKjp-Regular.otf';
$y = 30;
foreach($points as $point){
    imagettftext($im, 20, 0, 0, $y, 0xffffff, $font, $point);
    $y = $y + 30;
}
header('Content-Type: image/png;');
imagepng($im);
imagedestroy($im);

좋은 웹페이지 즐겨찾기