ImageTTFText(画像ID, 文字サイズ, アングル, X座標, y座標, 文字色, フォントtのファイル,文字列); |
<?php Header ("Content-type: image/png"); $image = imagecreate(200, 200); $black = imagecolorallocate($image, 0, 0, 0); $white = imagecolorallocate($image, 255,255, 255); $txt = mb_convert_encoding("離れPHP島", "SJIS", "UTF-8"); ImageTTFText ($image, 25, 0, 10, 60, $white, "../common/font/ipaexg.ttf",$txt); imagepng($image); imagedestroy($image); ?> ?> |
<img src="./php2004010601.php" height=100 width=100>
|
$txt = mb_convert_encoding("離れPHP島", "SJIS", "UTF-8"); |
ImageTTFText ($image, 25, 0, 10, 60, $white, "../common/font/ipaexg.ttf",$txt); |
ImageTTFText ($image, 25, 0, 10, 20, $white, "../common/font/ipaexg.ttf",$txt); |
$txt = mb_convert_encoding("まさご", "SJIS", "UTF-8"); ImageTTFText ($image, 40, 0, 10, 100, $white, "../common/font/dasaji_win.TTF",$txt); |
<?php $txt = mb_convert_encoding("まさご", "SJIS", "UTF-8"); ImageTTFText ($image, 40, 0, 10, 100, $white, "../common/font/dasaji_win.TTF",$txt); $txt = mb_convert_encoding("りゅう", "SJIS", "UTF-8"); ImageTTFText ($image,20, 90, 150, 180, $white, "../common/font/dasaji_win.TTF",$txt); ?> |
(オマケ) 色は16進数も使うことができます。 $white = imagecolorallocate($image,0xFF,0xFF,0xFF); は $white = imagecolorallocate($image,255,255,255); と同じです。 |
HOME |