qrencode binary How to use it: * qrencode var must contain the path of the qrencode binary * call the php function in post header (in every page showing post) from your theme. * Itīs not neccessary to give any parameters! * It will verify if the qrcode already exists, and will create it only at the first acces of a post (from you blog visitors), will take no time to generate (tested for 10 posts on a singlecore 1,8Ghz celeron) mutualized server. * qrcode for article 12345 will be placed in 12/345.png so the directory will not grow too much, with posts revision not all numbers will be used so file part should be little than 999. * qrcode TODO : * Add the ability to have a HTTP and HTTPS version depending on actual protocol used (should be easy) */ /* Shortcode function */ function qrcoder_pop() { $qrencode='/usr/bin/qrencode'; /* get upload_path */ $upload_dir = wp_upload_dir(); $ze_id = get_the_ID(); $arr = sprintf("%1$05d", $ze_id); $ar1 = substr($arr, 0, 2); $ar2 = substr($arr, 2, 3); $alt = "post ".$ze_id; $qrbase = $upload_dir['basedir']."/qrcodes/"; $qrdir = $qrbase.$ar1; $qrfile = $qrdir.'/'.$ar2.".png"; if (!file_exists($qrfile)) { if (!file_exists($qrdir)) { if (!file_exists($qrbase)) { mkdir($qrbase,0775); } mkdir($qrdir,0775); } exec($qrencode." -o ".$qrfile.' -m 2 '.site_url('','http').'/?p='.$ze_id); } echo ''; } ?>