こんな感じ。
$width = 300;// px $height = 40;// px $text = 'This is a sample.';// string $font = /usr/share/fonts/bitstream-vera/ACaslonPro-Bold.otf';// path $im = imagecreatetruecolor($width, $height); $color = imagecolorallocate($im, 0, 0, 0); $backgroundColor = imagecolorallocate($im, 255, 255, 255); imagefilledrectangle($im, 0, 0, 299, 99, $backgroundColor); imagettftext($im, 14, 0, 14, 20, $color, $font, $text); header('Content-type: image/png'); imagepng($im); imagedestroy($im);
さくっと。
ファイル名とか使って上手くキャッシュできそうだ=3