Home >Backend Development >PHP Tutorial >PHP convert text to image

PHP convert text to image

WBOY
WBOYOriginal
2016-07-23 08:54:551379browse
  1. header("Content-type: image/png");
  2. $string = $_GET['text'];
  3. $im = imagecreatefrompng("images/button.png");
  4. $color = imagecolorallocate($im, 255, 255, 255);
  5. $px = (imagesx($im) - 7.5 * strlen($string)) / 2;
  6. $py = 9;
  7. $fontSize = 1;
  8. imagestring($im, fontSize, $px, $py, $string, $color);
  9. imagepng($im);
  10. imagedestroy($im);
  11. ?>
复制代码

转换成, PHP


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn