Introducing a NEW QR Generator


When people ask me which QR generator to use, I usually suggest Google Charts. However, recently I've become dissatisfied with its limitations, so I've decided to write and release my own QR encoder.

I'm still looking for a catchy name for it (suggestions welcomed) - so for now it's called "QR Generator PHP".

It's available on GitHub or you can use it directly.

So, how does it compare to Google Charts?

Feature New QR Encoder Google Charts
Image Formats PNG, JPG, GIF PNG
Maximum Image Size 1480*1480px 547*547px
Unicode Support Yes No
Downloadable Images Yes- to a specific filename No
Open Source Yes No
Run on your own webserver? Yes No

Usage

Usage is really simple.

To generate a QR code which says "hello":
qr.php?d=hello
(Click to see the QR code)

You can set the size with, oddly enough, the size parameter:
qr.php?d=hello&size=1000
Size can be up to 1480 pixels.

You can set the image format to JPG or GIF. By default it outputs PNG.
qr.php?d=hello&t=J

The Error Correction can be set to L, M, Q, or H.
qr.php?d=hello&e=H

You can also tell the web browser to download the image - rather than just display it. The "download" parameter sets the filename for the image.
qr.php?d=hello&t=g&download=testing
The file will be called testing.gif (filetype is determined automatically)

Installation and configuration

Installing the software on your web server is easy. You need PHP4.1 or higher and gd 1.6 or higher. Those are fairly old versions, so any competent web host will have those.

There are three folders.

 |_php
 |_data
 |_image

DO NOT TOUCH THE CONTENTS OF THE data AND image FOLDERS.

Inside the php folder, you'll find the "qr.php" file.

There are only two things you need to configure - the location of the data and image folders

$path = "./../data"; // You must set path to data files.
$image_path = "./../image"; // You must set path to QRcode frame images.

By default, they're set up to be accessed without any modification. But, if you desperately want to move them to a different location, make sure you update qr.php.

Copyright

I've based my QR generator on that of Swetake. The original was licensed as "revised BSD" - I have kept the original licence.

Feedback

If you've got any feedback - either leave it in the comments here, or over at GitHub.

4 thoughts on “Introducing a NEW QR Generator

  1. Your comparison isn't really fair as Google Charts does support Unicode by UTF-8 (which is actually the default) and you can technically download the images.

    1. As I understand, it URL escapes all the characters - this one doesn't
      (although I'll be updating it to allow it).
      While you can download Google's images - it doesn't have the correct contnet disposition to allow you to do it automatically.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.