载入phpqrcode,并使用合成图片

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
include('phpqrcode.php");
$filename = "xxx.png";//图片路径
$errorCorrectionLevel = 'L';//容错级别
$matrixPointSize = 3; //生成图大小
$url = 'http://idiot6.com';
QRcode::png($url, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
$QR = "xxx.png"; // qr
$logo = 'layout-bg-1.png';// bg
$QR = imagecreatefromstring ( file_get_contents ( $QR ) ); //open picture source
$logo = imagecreatefromstring ( file_get_contents ( $logo ) ); //open picture source
imagecopyresampled ( $logo, $QR,565,215,0,0,154,154,$QR_width, $QR_height ); // mixed picture
$result_png = rand(100000, 999999) . uniqid() . ".png"; // file name
$file = '/data/www/upload/qrcode/' . $result_png;
imagepng ( $logo, $file );//output picture

qrcode download

phpqrcode