php 文本文字建立產生圖片
現在有不少人要產生文本映像。 PHP的GD庫允許我們這樣做就是這樣。這裡我們給出一個簡單的方法,是把映像網頁上使用的電子郵件地址。有人說,這有助於保持電子郵件收割機遠,但其光學字元辨識這仍然是可能的。
// show the correct header for the image type
header("Content-type: image/jpg");
// an email address in a string
$string = "email@example.com";
// some variables to set
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);
// lets begin by creating an image
$im = @imagecreatetruecolor ($width,$height);
//white background
$background_color = imagecolorallocate ($im, 255, 255, 255);
//black text
$text_color = imagecolorallocate ($im, 0, 0, 0);
// put it all together
imagestring ($im, $font, 0, 0, $string, $text_color);
// and display
imagejpeg ($im);
?>
http://www.bkjia.com/PHPjc/444985.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444985.htmlTechArticlephp 文本文字建立產生圖片 現在有不少人要產生文本映像。 PHP的GD庫允許我們這樣做就是這樣。這裡我們給出一個簡單的方法,是把映像網...