PHP gd库生成微信国旗头像

//背景图片路径
$srcurl = '头像.jpeg';
//目标图片路径
$desurl = '透明国旗.png';

//创建源图的实例
$src = imagecreatefromstring(file_get_contents($srcurl));

//创建点的实例
$des = imagecreatefrompng($desurl);

//获取点图片的宽高
list($point_w, $point_h) = getimagesize($desurl);
list($point_w1, $point_h1) = getimagesize($srcurl);
imagecopyresampled($src, $des,0,0,0,0,$point_w1,$point_h1,$point_w,$point_h);
header('Content-Type: image/jpeg');
imagejpeg($src);
imagedestroy($src);
imagedestroy($des);

微信头像

头像 < = = > 完成

透明国旗⬇️

国旗透明图
?

发布了38 篇原创文章 · 获赞 9 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_42260789/article/details/101368093
今日推荐