【发布时间】:2012-12-03 17:02:36
【问题描述】:
这是否可以在 php 中创建具有各种文本字体、样式、格式和对齐方式的背景图像的 gif 图像?
例如,我有一个背景图片,例如
我想在背景图片上插入的图片是
输出的 gif 图像应该是这样的
我试过这个代码
<?php
// Create a new image instance
$im = imagecreatetruecolor(300, 250);
$img = imagecreatefrompng('back.png');
// Make the background white
imagefilledrectangle($im, 0, 0, 300, 250, 0xEFEFEF);
// Draw a text string on the image
imagestring($im, 20,20, 40, 'Heading1', 0x000000);
imagecopymerge($img, $im, 0, 0, 0, 0, 300, 250, 70);
// Output the image to browser
header('Content-Type: image/gif');
imagegif($img,'test.gif');
imagedestroy($im);
?>
但不幸的是,它没有提供所需的输出,我想向背景图像添加更多内容,如输出图像中所示。
【问题讨论】:
标签: php