commit | author | age
|
3e083b
|
1 |
<?php |
B |
2 |
define('IN_ECS', true); |
|
3 |
require(dirname(__FILE__) . '/includes/init.php'); |
|
4 |
require(dirname(__FILE__) . '/includes/phpqrcode.php'); |
|
5 |
|
|
6 |
|
|
7 |
$sid= isset($_GET['sid']) ? intval($_GET['sid']) : 0; |
|
8 |
|
|
9 |
$urlinfo = pathinfo($_CFG['erweima_wapurl']); |
|
10 |
$data = $urlinfo['dirname']; |
|
11 |
if($sid>0){ |
|
12 |
$data = $urlinfo['dirname'].'/supplier.php?suppId='.$sid; |
|
13 |
} |
|
14 |
|
|
15 |
$errorCorrectionLevel = 'L';//容错级别 |
|
16 |
$matrixPointSize = 6;//生成图片大小 |
|
17 |
//生成二维码图片 |
|
18 |
$QR = QRcode::png($data, 'supplier.png', $errorCorrectionLevel, $matrixPointSize, 2); |
|
19 |
|
|
20 |
$QR = 'supplier.png';//已经生成的原始二维码图 |
|
21 |
|
|
22 |
if ($logo !== FALSE) { |
|
23 |
$QR = imagecreatefromstring(file_get_contents($QR)); |
|
24 |
$logo = imagecreatefromstring(file_get_contents($logo)); |
|
25 |
$QR_width = imagesx($QR);//二维码图片宽度 |
|
26 |
$QR_height = imagesy($QR);//二维码图片高度 |
|
27 |
$logo_width = imagesx($logo);//logo图片宽度 |
|
28 |
$logo_height = imagesy($logo);//logo图片高度 |
|
29 |
$logo_qr_width = $QR_width / 5; |
|
30 |
$scale = $logo_width/$logo_qr_width; |
|
31 |
$logo_qr_height = $logo_height/$scale; |
|
32 |
$from_width = ($QR_width - $logo_qr_width) / 2; |
|
33 |
//重新组合图片并调整大小 |
|
34 |
imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, |
|
35 |
$logo_qr_height, $logo_width, $logo_height); |
|
36 |
} |
|
37 |
//输出图片 |
|
38 |
//imagepng($QR, 'helloweba.png'); |
|
39 |
//echo '<img src="helloweba.png">'; |
|
40 |
header('Content-type: image/png'); |
|
41 |
imagepng($QR); |
|
42 |
imagedestroy($QR); |
|
43 |
|
|
44 |
?> |