$pic_path ) {
$kk = $k + 1;
if ( in_array($kk, $lineArr) ) {
$start_x = $line_x;
$start_y = $start_y + $pic_h + $space_y;
}
$resource = imagecreatefromjpeg($pic_path.$format);
// $start_x,$start_y copy图片在背景中的位置
// 0,0 被copy图片的位置 $pic_w,$pic_h copy后的高度和宽度
imagecopyresized($background,$resource,$start_x,$start_y,0,0,$pic_w,$pic_h,imagesx($resource),imagesy($resource)); // 最后两个参数为原始图片宽度和高度,倒数两个参数为copy时的图片宽度和高度
$start_x = $start_x + $pic_w + $space_x;
}
$fname= date('YmdHis').rand(100,999);
$imagePath = './Public/Temp/'.$fname.'.jpg';
// header("Content-type: image/jpg");
// imagejpeg($background);die;
// 保存图像为 $imagePath.'$fname'.'.jpg'
$res = imagejpeg($background,$imagePath); // imagejpeg($background,'./public/$uid_.$group.jpg');
if (false === $res) {
return false;
}
// 释放内存
imagedestroy($background);
return $imagePath;
}
?>
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了php实现微信中的图片合并-九宫格图片,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉
本文系统来源:php中文网