PHP生成二维码库phpqrcode
Description
PHP QR Code is open source (LGPL) library for generating QR Code, 2-dimensional barcode. Based on libqrencode C library, provides API for creating QR Code barcode images (PNG, JPEG thanks to GD2). Implemented purely in PHP.
Features
- Supports QR Code versions (size) 1-40
- Numeric, Alphanumeric, 8-bit and Kanji encoding.
- Implemented purely in PHP, no external dependencies except GD2
- Exports to PNG, JPEG images, also exports as bit-table
- TCPDF 2-D barcode API integration
- Easy to configure
- Data cache for calculation speed-up
- Debug data dump, error logging, time benchmarking
- Provided merge tool helps deploy library as a one file
- new! API documentation
- new! Over 30 detailed examples
- 100% Open Source, LGPL Licensed
Demo

项目地址:http://sourceforge.net/projects/phpqrcode/
Generate fixed size images
* phpqrcode本身未提供固定大小二维码的设置,请参考 http://sourceforge.net/p/phpqrcode/discussion/1111884/thread/f739531a/
--- original/phpqrcode/qrimage.php 2010-08-18 07:06:24.000000000 -0700
+++ qrimage.php 2012-07-13 00:51:57.000000000 -0700
@@ -86,10 +86,15 @@
}
}
- $target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
- ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
+
+ $targetW = (defined('IMAGE_WIDTH') ? IMAGE_WIDTH : $imgW * $pixelPerPoint );
+ $targetH = (defined('IMAGE_HEIGHT') ? IMAGE_HEIGHT : $imgH * $pixelPerPoint );
+
+ $target_image =ImageCreate($targetW, $targetH);
+
+ ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $targetW, $targetH, $imgW, $imgH);
ImageDestroy($base_image);
return $target_image;
}
- }
\ No newline at end of file
+ }
用法,设置生成的二维码宽高为 500px
define('IMAGE_WIDTH', 500);
define('IMAGE_HEIGHT', 500);
QRcode::png('http://www.cnblogs.com/toby/)');
PHP生成二维码库phpqrcode的更多相关文章
- 使用PHP生成二维码(PHPQRCode)
关于什么是二维码,可以阅读 http://baike.baidu.com/view/132241.htm 这里就不多讲了,二维码的应用非常广泛,似乎一夜之间渗透到我们生活的方方面面,地铁广告.报纸.火 ...
- ThinkPHP框架整合phpqrcode生成二维码DEMO
ThinkPHP框架发展到今天功能已经变得是非常强大了,但是ThinkPHP框架中没有二维码相关的库,因此我们可以通过整合phpqrcode来完成生成二维码的功能.想使用phpqrcode首先就要把p ...
- 使用phpqrcode生成二维码
使用PHP语言生成二维码,还是挺有难度的,当然调用生成二维码图片的接口(比如:联图网http://www.liantu.com/的接口)除外,如果自己写代码生成,真的无从下手.然而,我们可以使用php ...
- php--------php库生成二维码和有logo的二维码
php生成二维码和带有logo的二维码,上一篇博客讲的是js实现二维码:php--------使用js生成二维码. 今天写的这个小案例是使用php库生成二维码: 效果图: 使用了 php ...
- PHP基于phpqrcode类生成二维码的方法详解
前期准备: 1.phpqrcode类文件下载,下载地址:https://sourceforge.net/projects/phpqrcode/2.PHP环境必须开启支持GD2扩展库支持(一般情况下都是 ...
- php使用phpqrcode生成二维码
前期准备: 1.phpqrcode类文件下载,下载地址:https://sourceforge.net/projects/phpqrcode/2.PHP环境必须开启支持GD2扩展库支持(一般情况下都是 ...
- phpqrcode 生成二维码
这个项目需要根据信息来自动生成二维码,到网上搜了下,发现php有生成二维码的类库phpqrcode,所以打算就用这个来生成二维码 从官网下载类库源码http://sourceforge.net/pro ...
- php调用phpqrcode.php生成二维码
下载phpqrcode.php 下载地址: http://files.cnblogs.com/files/qhorse/phpqrcode.rar qrcode.php文件: <?php inc ...
- thinkphp调用phpqrcode.php生成二维码
thinkphp3. 把phpqrcode文件夹放在ThinkPHP\Library\Vendor\下面 phpqrcode下载: http://files.cnblogs.com/files/qho ...
随机推荐
- ContextLoaderListener与DispatcherServlet所加载的applicationContext的区别
spring通过在web.xml 中配置ContextLoaderListener 来加载context配置文件,在DispatcherServlet中也可以来加载spring context配置文件 ...
- Java8新特性【转】
地址:http://ifeve.com/java-8-features-tutorial/ 1.简介 毫无疑问,Java 8是自Java 5(2004年)发布以来Java语言最大的一次版本升级,Ja ...
- 使用U盘在X230上安装Mavericks/Win7-黑苹果之路
新笔记本x230,毫不犹豫继续开始黑苹果之路,这次当然是上最新版本了,谁知道这条道路真是曲折艰难啊,从年前开始,直到前天才算安装成功,还有一堆硬件没驱动上,现记录过程以备以后查看: 1.准备机器.本来 ...
- OC基础(3)
对象的存储细节 函数与方法对比 常见错误 *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bot ...
- 类成员函数指针 ->*语法剖析
在cocos2d-x中,经常会出现这样的调用,如 ->*,这个是什么意思呢,如下面得这个例子: , 其实这是对类的成员函数指针的调用,在cocos2dx中,这种形式多用于回调函数的调用.如我们经 ...
- git 仓库操作
一.git 仓库从远程clone 首先要建立一个本地空目录文件比如 RuntimeJsonModel,然后: 1. git init 2. git clone https://github.com/G ...
- 【Unity Shaders】学习笔记——渲染管线
[Unity Shaders]学习笔记——Shader和渲染管线 转载请注明出处:http://www.cnblogs.com/-867259206/p/5595924.html 写作本系列文章时使用 ...
- 【LeetCode】84. Largest Rectangle in Histogram
Largest Rectangle in Histogram Given n non-negative integers representing the histogram's bar height ...
- fastcgi(一)
首先安装 fastcgi 开发包 ... #wget http://www.fastcgi.com/dist/fcgi-current.tar.gz #tar -zxvf fcgi-current.t ...
- Select的深入应用(1)
在子句中使用列的位置: 使用select语句创建新表: 在子句中使用列的别名: 注意,你的 ANSI SQL 不允许你在一个WHERE子句中引用一个别名.这是因为在WHERE代码被执行时,列值还可能没 ...