PHP合并两张图片的实现

代码如下:

$bigImgPath = "./images/bg.jpg";
$qCodePath = "./images/thumb/$id.jpg";

$bigImg = imagecreatefromstring(file_get_contents($bigImgPath));
$qCodeImg = imagecreatefromstring(file_get_contents($qCodePath));

list($qCodeWidth, $qCodeHight, $qCodeType) = getimagesize($qCodePath);

imagecopymerge($bigImg, $qCodeImg, 239, 677, 0, 0, $qCodeWidth, $qCodeHight, 100);
 
list($bigWidth, $bigHight, $bigType) = getimagesize($bigImgPath);

imagejpeg($bigImg,'./images/'.$id.'.jpg');

imagejpeg输出图片,并保存。

猜你喜欢

转载自blog.csdn.net/gdali/article/details/77994894