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

PHP convert text to image

WBOY
Release: 2016-07-23 08:54:55
Original
1385 people have browsed it
  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


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template