我正在尝试创建一个图像使用2个不同的PNG图像,但我不能得到它的工作。没有错误或任何东西,但我没有创建图像。
另外,是否有可能在最终图像上放置一些文本,然后将其保存(将文本硬编码到其中)?
测试样本
<?php
$image_1 = imagecreatefrompng('assets/img/image_body.png');
$image_2 = imagecreatefrompng('assets/img/img_2.png');
imagealphablending($image_1, true);
imagesavealpha($image_1, true);
imagecopy($image_1, $image_2, 0, 0, 0, 0, 100, 100);
imagepng($image_1, 'image_3.png');
?>发布于 2017-02-16 08:51:55
我改变了图像的位置
$_SERVER['DOCUMENT_ROOT'];此代码正在运行。
<?php
// This .php file is inside root>NP
$LOC = $_SERVER['DOCUMENT_ROOT'];
$image_1 = imagecreatefrompng($LOC . '/NP/m1.png');
$image_2 = imagecreatefrompng($LOC . '/NP/m2.png');
imagealphablending($image_1, true);
imagesavealpha($image_1, true);
imagecopy($image_1, $image_2, 0, 0, 0, 0, 640, 400);
imagepng($image_1, $LOC.'/NP/m3.png');
?>https://stackoverflow.com/questions/42262537
复制相似问题