随笔 · 2016/02/03 0

PHP把文本转换成图片

把文本转换成图片

<?php
header("Content-type: image/png");
$string = $_GET['text'];
$im = imagecreatefrompng("images/button.png");
$color = imagecolorallocate($im, 255, 255, 255);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
$py = 9;
$fontSize = 1;
imagestring($im, fontSize, $px, $py, $string, $color);
imagepng($im);
imagedestroy($im);
?>
0
希望看到您的想法,请您发表评论x