Login Latest Snippets Home My Account
Snippee! A personal code snippet manager... Store, share, organize! ...

QR Code Generator

Published: 2011-08-21 20:06:47 - In: PHP

Generate a QR code for any URL (via the Google API)

$urlToEncode="http://superiorwebsys.com";
generateQRwithGoogle($urlToEncode);
function generateQRwithGoogle($chl,$widthHeight='150', $EC_level='L', $margin='0') {
    $url = urlencode($url); 
    echo '<img src="http://chart.apis.google.com/chart?chs='.$widthHeight.'x'.$widthHeight.'&cht=qr&chld='.$EC_level.'|'.$margin.'&chl='.$chl.'" alt="QR code" widthHeight="'.$size.'" widthHeight="'.$size.'"/>';
}