1 Star 0 Fork 0

ica / ps_0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
makeqrcode.php 1.44 KB
一键复制 编辑 原始数据 按行查看 历史
ica 提交于 2018-07-22 22:38 . 20180722 -1
<?php
/**
* Created by PhpStorm.
* User: clkj1
* Date: 2018/7/6
* Time: 17:01
*/
require_once 'phpqrcode/phpqrcode.php';
if ( isset( $_POST['makeCode'] ) ) {
$string = $_POST['makeCode'];
QRcode::png( $string, 'images/qrcode.png', QR_ECLEVEL_L, 20, 4, false );
}
//$string = 'FAQ';
$string = 'https://mp.weixin.qq.com/s/z7hRSJfLxY_6Q6Rt_rbEzA';
QRcode::png( $string, 'images/qrcode.png', 3, 3, 4, false );
list( $qrcode_width, $qrcode_height ) = getimagesize( 'images/qrcode.png' );
list( $logo_width, $logo_height ) = getimagesize( 'realPs/images/logooo.png' );
$image_qrcode = imagecreatefrompng( 'images/qrcode.png' );
$image_logo = imagecreatefromjpeg( 'realPs/images/logooo.png' );
$qrcode_bg = imagecreatetruecolor( 201, 201 );
$white = imagecolorallocatealpha( $qrcode_bg, 255, 255, 255, 0 );
$transparent = imagecolorallocatealpha( $qrcode_bg, 0, 0, 0, 127 );
imagefill( $qrcode_bg, 0, 0, $transparent );
imagecopyresampled( $qrcode_bg, $image_qrcode, 0, 0, 0, 0, 201, 201, $qrcode_width, $qrcode_height );
$logo_bg = imagecreate( 45, 45 );
imagefill( $logo_bg, 0, 0, $white );
imagecopyresampled( $logo_bg, $image_logo, 0, 0, 0, 0, 45, 45, $logo_width, $logo_height );
imagecopy( $qrcode_bg, $logo_bg, ( 201 / 2 - 45 / 2 ), ( 201 / 2 - 45 / 2 ), 0, 0, 45, 45 );
header('Content-Type: image/png');
imagepng($qrcode_bg, './realPs/images/qrcode2.png');
imagepng($qrcode_bg);
imagedestroy($qrcode_bg);
?>
<!--<img src="images/qrcode.png"/>-->
PHP
1
https://gitee.com/ica520/ps_0.git
git@gitee.com:ica520/ps_0.git
ica520
ps_0
ps_0
master

搜索帮助