Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QRCodes
#1
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
My Github Repos: Github
Website: DigiMute
Reply




Users browsing this thread: 1 Guest(s)