このスクリプトを使用して、php-gd ライブラリを使用して HTML コードを画像に変換します。
<?php
//put your html code here
$html_code = '
<html>
<body>
Image Out Put sadadasdasdasdasdasd
</body>
</html>
';
$img = imagecreate("300", "600");
imagecolorallocate($img,0,0,0);
$c2 = imagecolorallocate($img,70,70,70);
imageline($img,0,0,300,600,$c2);
imageline($img,300,0,0,600,$c2);
$white = imagecolorallocate($img, 255, 255, 255);
imagettftext($img, 9, 0, 1, 1, $white, "arial.ttf", $html_code);
header('Content-type: image/jpeg');
imagejpeg($img);
?>
サイトのURL:
http://almogas.com/temp/phpimage.php?id=3
未知のキャラクターがたくさん出てきます。この動作を修正するにはどうすればよいですか?
/////////////////////////////////////////////
編集
スペースを削除した後に機能するようになりました
しかし、背景画像を追加する方法はありますか? ありがとうございました