©
This document uses PHP Chinese website manual Release
Example #1 使用 PHP 创建 PNG 图像
<?php
header ( "Content-type: image/png" );
$string = $_GET [ 'text' ];
$im = imagecreatefrompng ( "images/button1.png" );
$orange = imagecolorallocate ( $im , 220 , 210 , 60 );
$px = ( imagesx ( $im ) - 7.5 * strlen ( $string )) / 2 ;
imagestring ( $im , 3 , $px , 9 , $string , $orange );
imagepng ( $im );
imagedestroy ( $im );
?>
[#1] Jeff [2015-03-30 21:59:39]
Keep in mind that transparency is not preserved when doing what is shown in Example #1 to a PNG with transparency.