PHP and QR codes

Download PHP script

The first step in this tutorial is to download the code to make the QR code:

Using the script

After you have downloaded and extracted the files look for the file called qr_img.php in the php folder.

Parameters

Below are some of the parameters to make your QR code.

Parameter Description Default
d The data to encode NULL
e Error correction level M
t Image type (JPEG or PNG) PNG

Error correction

There are 4 settings for error correction: L,M,Q,H. The highest level of error correction is H, and the lowest L.

Examples

Basic URL encoding example:

qr_img.php?d=http://pixelcode.co.uk&e=H

JPEG example:

qr_img.php?d=http://pixelcode.co.uk&e=H&t=J

HTML image example:

<img src="qr_img.php?d=http://pixelcode.co.uk&e=H" alt="QR code for URL pixelcode.co.uk" />

In all of these examples the error correction has been set to its highest level H meaning that it is still a valid code even if some of the encoding is not scanned properly.

Example image

QR code for URL pixelcode.co.uk

Categories

Tags

Social