QR codes are a popular type of two-dimensional barcode. They are also known as hardlinks or physical world hyperlinks. QR Codes store up to 4,296 alphanumeric characters of arbitrary text. This text can be anything, for example URL, contact information, a telephone number, even random text. QR codes can be read by an optical device with the appropriate software. Such devices range from dedicated QR code readers to mobile phones (if you have a barcode scanner application it's likely it already reads QR codes).
This snippet is to support an article on our website: Include QR Codes on Your Website.
The following code utilizes the Google Charts API to render the resulting code.
1
<?php
2
/*
3
Create QR Codes with Google Charts
4
Article: Include QR Codes on Your Website
5
http://www.beliefmedia.com/qr-codes-website
6
*/
7
8
9
return '<img src="http://chart.apis.google.com/chart?chs=' . $w . 'x' . $w . '&cht=qr&chld=' . strtoupper($ec) . '|' . $margin . '&chl=' . urlencode($url) . '" alt="' . $alt . '" width="' . $w . '" height="' . $w .'"/>';
10
}
11
12
/* Usage */
13
$url = 'This is text. Can be anything';
14
WordPress version here.