【发布时间】:2011-06-14 23:35:20
【问题描述】:
我正在尝试通过使用 PHP GD 合并图像来动态生成图像。我想知道是否有一种方法可以在我的网页中显示图像,而无需将其存储在服务器上的某个位置。
例如,我创建了以下用于合并图像的代码...
function create_image() {
$main_image = imagecreatefrompng("images/main.png");
$other_image = imagecreatefrompng("images/other.png");
imagecopy($main_image, $other_image, 114, 53, 0, 0, 49, 34);
imagepng($main_image);
imagedestroy($other_image);
}
到目前为止,我的 html 代码是...
<div class="sidebar-avatar">
<img src="avatar_pattern.png" class="pattern1" width="430" height="100" />
</div>
我应该如何调用php函数,以便它显示在我为其指定的div中生成的图像。
更新:我发现使用了Content-type: image/png,但这意味着我必须在单独的页面上显示图像,而不是内联。
【问题讨论】: