PHP realizes picture merging in WeChat-Jiugongge pictures

WBOY
Release: 2016-07-29 09:16:00
Original
1962 people have browsed it
$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; } ?>
Copy after login

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the PHP implementation of image merging in WeChat - Jiugongge pictures, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!