include ‘phpqrcode.php’;
$value = ‘http://www.helloweba.com’; //二维码内容
$errorCorrectionLevel = ‘L’;//容错级别
m
a
t
r
i
x
P
o
i
n
t
S
i
z
e
=
6
;
/
/
生
成
图
片
大
小
/
/
生
成
二
维
码
图
片
Q
R
c
o
d
e
:
:
p
n
g
(
matrixPointSize = 6;//生成图片大小 //生成二维码图片 QRcode::png(
matrixPointSize=6;//生成图片大小//生成二维码图片QRcode::png(value, ‘qrcode.png’, $errorCorrectionLevel, $matrixPointSize, 2);
$logo = ‘logo.png’;//准备好的logo图片
Q
R
=
′
q
r
c
o
d
e
.
p
n
g
′
;
/
/
已
经
生
成
的
原
始
二
维
码
图
i
f
(
QR = 'qrcode.png';//已经生成的原始二维码图 if (
QR=′qrcode.png′;//已经生成的原始二维码图if(logo !== FALSE) {
Q
R
=
i
m
a
g
e
c
r
e
a
t
e
f
r
o
m
s
t
r
i
n
g
(
f
i
l
e
g
e
t
c
o
n
t
e
n
t
s
(
QR = imagecreatefromstring(file_get_contents(
QR=imagecreatefromstring(filegetcontents(QR));
l
o
g
o
=
i
m
a
g
e
c
r
e
a
t
e
f
r
o
m
s
t
r
i
n
g
(
f
i
l
e
g
e
t
c
o
n
t
e
n
t
s
(
logo = imagecreatefromstring(file_get_contents(
logo=imagecreatefromstring(filegetcontents(logo));
Q
R
w
i
d
t
h
=
i
m
a
g
e
s
x
(
QR_width = imagesx(
QRwidth=imagesx(QR);//二维码图片宽度
Q
R
h
e
i
g
h
t
=
i
m
a
g
e
s
y
(
QR_height = imagesy(
QRheight=imagesy(QR);//二维码图片高度
l
o
g
o
w
i
d
t
h
=
i
m
a
g
e
s
x
(
logo_width = imagesx(
logowidth=imagesx(logo);//logo图片宽度
l
o
g
o
h
e
i
g
h
t
=
i
m
a
g
e
s
y
(
logo_height = imagesy(
logoheight=imagesy(logo);//logo图片高度
$logo_qr_width = $QR_width / 5;
$scale =
l
o
g
o
w
i
d
t
h
/
logo_width/
logowidth/logo_qr_width;
$logo_qr_height =
l
o
g
o
h
e
i
g
h
t
/
logo_height/
logoheight/scale;
f
r
o
m
w
i
d
t
h
=
(
from_width = (
fromwidth=(QR_width -
l
o
g
o
q
r
w
i
d
t
h
)
/
2
;
/
/
重
新
组
合
图
片
并
调
整
大
小
i
m
a
g
e
c
o
p
y
r
e
s
a
m
p
l
e
d
(
logo_qr_width) / 2; //重新组合图片并调整大小 imagecopyresampled(
logoqrwidth)/2;//重新组合图片并调整大小imagecopyresampled(QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width,
$logo_qr_height, $logo_width, KaTeX parse error: Expected 'EOF', got '}' at position 15: logo_height); }̲ //输出图片 imagepn…QR, ‘helloweba.png’);
echo ‘’;
草料二维码生成怎么用php代码实现
最新推荐文章于 2024-07-23 13:58:41 发布