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);

  

posted @ 2016-09-26 11:50  八路逆袭寡妇村  阅读(127)  评论(0编辑  收藏  举报
www.shiciyue.com