pear:packages:image_qrcode

Usage

Generating QRCodes

$qrcode = new Image_QRCode();
$qrcode->makeCode('http://pear.php.net/');

The second parameter of makeCode() allows runtime configuration using an options array.

Name Type Description
image_type string Defines the return image type (from 'jpeg', or 'png'). Default is PNG format
output_type string Sets what to do once the code has been generated ('display' or 'return'). Default is to display the image, complete with headers.
error_correct string Sets the error correction level. One of: L: 7% error level M: 15% error level Q: 25% error level H: 30% error level
module_size integer Sets the default module size Defaults are PNG: 4, JPEG: 8

Generating JPEG image with best error correction

require_once 'Image/QRCode.php';

$qrcode = new Image_QRCode();
$qrcode->makeCode('http://pear.php.net/', array(
    'image_type' => 'jpeg',<br>
    'error_correct' => 'H', // 30% error correction<br>
));
pear/packages/image_qrcode.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1