码迷,mamicode.com
首页 > Web开发 > 详细

php多图合并

时间:2016-09-26 12:40:08      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:

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多图合并

标签:

原文地址:http://www.cnblogs.com/yuesha/p/5908617.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!