我有这个测试页面http://thechozenfew.net/projects/write_font.php,它将输入框中的文本生成为字体。每个字母是一个不同的图片,我如何将所有这些图片加入到一个PHP脚本的图像?使用PHP脚本将多个图像合并为一个
这是我迄今试过的,但图像显示在彼此之上。
Header ("Content-type: image/gif");
$image1Url = "../images/avatar.png";
$image2Url = "../images/key.png";
$image3Url = "../images/safari.png";
$image1 = imageCreateFromPNG($image1Url);
$image2 = imageCreateFromPNG($image2Url);
$image3 = imageCreateFromPNG($image3Url);
$colorTransparent = imagecolorat($image1, 0, 0);
imageColorTransparent ($image1, $colorTransparent);
$colorTransparent = imagecolorat($image2, 0, 0);
imageColorTransparent ($image2, $colorTransparent);
$colorTransparent = imagecolorat($image3, 0, 0);
imageColorTransparent ($image3, $colorTransparent);
imageCopyMerge($image1, $image2, 0, 0, 0, 0, 96, 96, 100);
imageCopyMerge($image1, $image3, 0, 0, 0, 0, 96, 96, 80);
ImagePng ($image1);
ImageDestroy ($image1);
ImageDestroy ($image2);
它可能对某些浏览器工作,如果头文件和实际内容类型不匹配。标题(“Content-type:image/gif”); ... ImagePng($ image1); – Darkerstar