GetSimple Support Forum
QRCodes - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Scripts & Components (http://get-simple.info/forums/forumdisplay.php?fid=11)
+--- Thread: QRCodes (/showthread.php?tid=3305)



QRCodes - n00dles101 - 2012-06-26

A small script that uses Google Chart API to generate QRCodes for your site pages.

Copy the following script to your themes 'functions.php'

Code:
function google_qr($url,$size ='150',$EC_level='L',$margin='0') {
    $url = urlencode($url);
    echo '<img src="https://chart.googleapis.com/chart?chs='.$size.'x'.$size.'&cht=qr&chld='.$EC_level.'|'.$margin.'&chl='.$url.'" alt="QR code" width="'.$size.'" height="'.$size.'"/>';
}


to use just call it like so in your theme:

Code:
google_qr(url);

// other options are:
// google_qr(url, size, ECLevel, margin);
// url is the URL for your QRCode
// size, size in pixels for image
// ECLevel, Error Correction Level
// margin, margin around image

See it in action here: http://www.digimute.com