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”.
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|
|Downloadable Images||Yes- to a specific filename||No|
|Run on your own webserver?||Yes||No|
Usage is really simple.
To generate a QR code which says “hello”:
(Click to see the QR code)
You can set the size with, oddly enough, the size parameter:
Size can be up to 1480 pixels.
You can set the image format to JPG or GIF. By default it outputs PNG.
The Error Correction can be set to L, M, Q, or 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.
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.
I’ve based my QR generator on that of Swetake. The original was licensed as “revised BSD” – I have kept the original licence.
If you’ve got any feedback – either leave it in the comments here, or over at GitHub.