微信生成公众号带参数二维码用户头像 加上文字生成图片(三)

来源:互联网 发布:mac磁盘空间不足 编辑:程序博客网 时间:2024/05/01 10:40
// 建立一幅 434X630 的图像
$im = imagecreatetruecolor(434,630);  //设置透明背景图  如果用imagecreate 则图片二维码上的用户头像变灰

$textcolor = imagecolorallocate($im, 255, 0, 255);
$str="你好!";   //解决中文乱码所以用imagettftext  方法
$white = imagecolorallocate($im, 255, 255, 255);
imagefill($im, 0, 0, $white);    //填充白色
imagettftext($im,25,0,5,40,$bg,THINK_PATH.'Library/Think/Verify/ttfs/simhei.ttf',$str);
$QR = imagecreatefromstring(file_get_contents("helloweba.png"));
imagecopy($im,$QR,2, 50,0, 0,430,430);
// 输出图像
header("Content-type: image/png");
imagepng($im);
exit;
0 0
原创粉丝点击