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输出图片,并保存。

你可能感兴趣的:(php)