PHP生成带头像的二维码
<?php require_once 'phpqrcode.php'; QRcode::png('http://www.baidu.com', 'filename.png',QR_ECLEVEL_L,100); // creates file $QR = imagecreatefrompng("filename.png"); $logo = imagecreatefrompng("logo.png"); var_dump($QR); var_dump($logo); $QR_width = imagesx($QR); $QR_height = imagesy($QR); //echo $QR_width; //echo $QR_height; $logo_width = imagesx($logo); $logo_height = imagesy($logo); //echo $logo_width; //echo $logo_height; // Scale logo to fit in the QR Code $logo_qr_width = $QR_width/9; $scale = $logo_width/$logo_qr_width; $logo_qr_height = $logo_height/$scale; $from_width = ($QR_width-$logo_qr_width)/2; //echo $from_width;exit; imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); imagepng($QR,'last.png');
如果是输出到浏览器上 把最好一句改成imagepng($QR);
具体在附件上
相关推荐
Allinputs 2020-08-30
Steven 2020-08-07
风萧萧梦潇 2020-07-30
small 2020-07-29
无缘公子 2020-06-28
wangdaren 2020-06-03
Develop 2020-06-01
zhaoyangjian 2020-05-26
gufudhn 2020-05-02
hgzhang 2020-04-23
yiyilanmei 2020-04-22
caishancai 2020-04-22
xieyixiao 2020-04-22
zcabcd 2020-04-18
cdkey 2020-04-17
D先生 2020-04-14
jiamingku 2020-04-10
85580695 2020-04-07
woniulx0 2020-03-26