首页 > 代码库 > php多图合并
php多图合并
function mergerImg($imgs) {
list($max_width, $max_height) = getimagesize($imgs[‘dst‘]);
$dests = imagecreatetruecolor($max_width, $max_height);
$dst_im = imagecreatefrompng($imgs[‘dst‘]);
imagecopy($dests,$dst_im,0,0,0,0,$max_width,$max_height);
imagedestroy($dst_im);
$src_im = imagecreatefrompng($imgs[‘src‘]);
$src_info = getimagesize($imgs[‘src‘]);
imagecopy($dests,$src_im,0,$max_height/2,0,0,$src_info[0],$src_info[1]);
imagedestroy($src_im);
header("Content-type: image/jpeg");
imagejpeg($dests);
}
$imgs = array(
‘dst‘ => ‘http://www.wangshangyou.com/content/uploadfile/201312/b3241386050881.png‘,
‘src‘ => ‘http://www.wangshangyou.com/content/uploadfile/201312/72691386051117.png‘
);
mergerImg($imgs);
php多图合并