php phpqrcode 生成二维码
2017-11-30 14:42
246 查看
<?php
// ==============php phpqrcode 生成二维码========================
// 下载地址:http://sourceforge.net/projects/phpqrcode/files/latest/download
// 只需要包含 phpqrcode.php 文件就可以。
// 一:直接输出
include "./phpqrcode.php";
$value="http://www.useryx.com";
$errorCorrectionLevel = "L"; // 纠错级别:L、M、Q、H
$matrixPointSize = "4"; // 点的大小:1到10
QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize);
// 二:图片文件输出
include('./phpqrcode.php');
$data = 'http://www.useryx.com';
$filename = 'useryx.png'; // 生成的文件名
$errorCorrectionLevel = 'L'; // 纠错级别:L、M、Q、H
$matrixPointSize = 4; // 点的大小:1到10
QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
//三: 生成中间带logo的二维码
include('./phpqrcode.php');
$value='http://www.useryx.com';
$logo = 'logo.jpg'; // 中间的logo
$QR = "base.png"; // 自定义生成的。结束后可以删除
$last = "last.png"; // 最终生成的图片
$errorCorrectionLevel = 'L';
$matrixPointSize = 10;
QRcode::png($value, $QR, $errorCorrectionLevel, $matrixPointSize, 2
ce0e
);
if($logo !== FALSE){
$QR = imagecreatefromstring(file_get_contents($QR));
$logo = imagecreatefromstring(file_get_contents($logo));
$QR_width = imagesx($QR);
$QR_height = imagesy($QR);
$logo_width = imagesx($logo);
$logo_height = imagesy($logo);
$logo_qr_width = $QR_width / 5;
$scale = $logo_width / $logo_qr_width;
$logo_qr_height = $logo_height / $scale;
$from_width = ($QR_width - $logo_qr_width) / 2;
imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
}
imagepng($QR,$last); // 生成最终的文件
?>
// ==============php phpqrcode 生成二维码========================
// 下载地址:http://sourceforge.net/projects/phpqrcode/files/latest/download
// 只需要包含 phpqrcode.php 文件就可以。
// 一:直接输出
include "./phpqrcode.php";
$value="http://www.useryx.com";
$errorCorrectionLevel = "L"; // 纠错级别:L、M、Q、H
$matrixPointSize = "4"; // 点的大小:1到10
QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize);
// 二:图片文件输出
include('./phpqrcode.php');
$data = 'http://www.useryx.com';
$filename = 'useryx.png'; // 生成的文件名
$errorCorrectionLevel = 'L'; // 纠错级别:L、M、Q、H
$matrixPointSize = 4; // 点的大小:1到10
QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
//三: 生成中间带logo的二维码
include('./phpqrcode.php');
$value='http://www.useryx.com';
$logo = 'logo.jpg'; // 中间的logo
$QR = "base.png"; // 自定义生成的。结束后可以删除
$last = "last.png"; // 最终生成的图片
$errorCorrectionLevel = 'L';
$matrixPointSize = 10;
QRcode::png($value, $QR, $errorCorrectionLevel, $matrixPointSize, 2
ce0e
);
if($logo !== FALSE){
$QR = imagecreatefromstring(file_get_contents($QR));
$logo = imagecreatefromstring(file_get_contents($logo));
$QR_width = imagesx($QR);
$QR_height = imagesy($QR);
$logo_width = imagesx($logo);
$logo_height = imagesy($logo);
$logo_qr_width = $QR_width / 5;
$scale = $logo_width / $logo_qr_width;
$logo_qr_height = $logo_height / $scale;
$from_width = ($QR_width - $logo_qr_width) / 2;
imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
}
imagepng($QR,$last); // 生成最终的文件
?>
相关文章推荐
- 使用开源 phpqrcode 生成二维码
- 使用phpqrcode生成二维码
- thinkphp使用phpqrcode生成带logo二维码
- TP整合phpqrcode生成二维码
- qrcode-php生成二维码
- php生成二维码的插件phpqrcode
- thinkphp 3.2 使用phpqrcode生成二维码,phpqrcode的使用
- phpqrcode 生成二维码
- QRcode php生成二维码
- php phpqrcode 生成二维码
- php通过Qrcode生成二维码
- PHP QRCode 生成二维码
- php结合phpqrcode生成带图片LOGO的二维码
- 使用phpqrcode生成二维码
- ThinkPHP框架整合phpqrcode生成二维码DEMO
- Sae使用storage保存phpqrcode生成的二维码
- PHP QRCODE生成彩色二维码的方法
- 使用PHP QRcode生成二维码广告图
- php调用phpqrcode.php生成二维码
- 使用phpqrcode生成二维码