PHP头条
热点:

php 文本文字创建生成图片


php 文本文字创建生成图片

现在有不少人要生成文本图像。 PHP的GD库允许我们这样做就是这样。这里我们给出一个简单的方法,是把图像网页上使用的电子邮件地址。有人说,这有助于保持电子邮件收割机远,但其光学字符识别这仍然是可能的。

<?php

  // 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);
?>

www.phpzy.comtrue/php/10633.htmlTechArticlephp 文本文字创建生成图片 php 文本文字创建生成图片 现在有不少人要生成文本图像。 PHP的GD库允许我们这样做就是这样。这里我们给出一个简单的方法,是把图像网页上使用的电子邮件...

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐