3

下線付きのテキストを表示し、結果をGDまたは他のライブラリで画像として出力する最良の方法は何ですか?

4

3 に答える 3

3

Unicode の下線結合文字を使用してみることができますU+0332

<?php
// Set the content-type
header('Content-type: image/png');

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = "&#x0332;U&#x0332;d&#x0332;e&#x0332;r&#x0332;l&#x0332;i&#x0332;n&#x0332;e";
// Replace path by your own font path
$font = 'arial.ttf';


// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
于 2009-03-28T11:39:10.357 に答える
0

無料の PHP CAPTCHA がたくさん出回っており、多くのカスタマイズが可能です。いずれかをダウンロードして、舞台裏で何が起こっているかを確認してください。こちらのリンクもご覧ください

HTH

于 2009-03-28T08:59:00.053 に答える