Thursday, August 21, 2008

QR Code for your blog

A QR Code is a matrix code (or two-dimensional bar code) created by Japanese corporation Denso-Wave in 1994. The "QR" is derived from "Quick Response", as the creator intended the code to allow its contents to be decoded at high speed. QR Codes are common in Japan where they are currently the most popular type of two dimensional codes.

© Wikipedia

QR-code Wordpress Plugin

This is plugin use QR-code Open Source library.

Download

August 2008: QR Code (version 0.1)

Installation

  1. Unpack archive
  2. Upload `a-qr-code` folder to the `/wp-content/plugins/` directory
  3. Set write permissions for `/wp-content/plugins/a-qr-code/cache` directory
  4. Activate the plugin through the 'Plugins' menu in WordPress

Change your templates

Place follow code in template file (page.php or single.php or archive.php or index.php or in all) between <?php while (have_posts()) : the_post(); ?> and <?php endwhile;?>

For only link to image with post URL:
<?php if (function_exists('aQRCode')) { echo aQRCode(get_permalink()); }?>
For image with post URL:
<?php if (function_exists('aQRCode')) { echo '<img src="'.aQRCode(get_permalink()).'" alt="QR Code for '.the_title('','',false).'"/> '; }?>

function aQRCode


Function aQRCode can receive follow params:
  1. String for encoding (string) - in example using result of function get_permalink()
  2. ECC level (string) - L (7%) or M (15%) or Q (25%) or H (30%)
  3. Image type (string) - J:jpeg image , other: PNG image
  4. Size (integer) - default PNG:4 JPEG:8, max 1480
  5. Version (integer) - 1-40 or Auto select if you do not set

QR-code Wordpress Plugin (Google Charts API)

This is plugin based on Google Charts API

Download

August 2008: QR Code (GCAPI) (version 0.1)

Installation

  1. Unpack archive
  2. Upload `a-qr-code-google` folder to the `/wp-content/plugins/` directory
  3. Activate the plugin through the 'Plugins' menu in WordPress

Change your templates

For only link to image with post URL:
<?php if (function_exists('aQRCodeG')) { echo aQRCode(get_permalink()); }?>

For image with post URL:
<?php if (function_exists('aQRCodeG')) { echo '<img src="'.aQRCode(get_permalink()).'" alt="QR Code for '.the_title('','',false).'"/> '; }?>


function aQRCodeG

Function aQRCodeG can receive follow params:
  1. String for encoding (string) - in example using result of function get_permalink()
  2. Image size (integer) - max 546 - default 150x150
  3. Charset (string) - Charset: Shift_JIS, UTF-8, or ISO-8859-1
  4. ECC level (string) - L (7%) or M (15%) or Q (25%) or H (30%)
  5. Margin (integer) - defines the margin (or blank space) around the QR code. The default image has a margin equivalent to 4 rows / columns of the chart.

QR code for Blogspot and other

This is JavaScript code based on Google Charts API.

Installation


Add new gadget "HTML/JavaScript" to your sidebar and insert follow JavaScript code:
<script type="text/javascript">
        // use current location as data
        var chl = new String(document.location);       
        pos = chl.indexOf('#',0);
        if (pos >= 0) {
            chl = chl.substr(0,pos);
        }   
             chl  = escape(chl); // escaped data
        var chs  = '150x150'; // Size: The largest possible area for all charts except maps is 300,000 pixels. As the maximum height or width is 1000 pixels, examples of maximum sizes are 1000x300, 300x1000, 600x500, 500x600, 800x375, and 375x800.
        var choe = 'UTF-8'; // Charset: Shift_JIS, UTF-8, or ISO-8859-1
        var chld = 'L'; // L allows 7% of a QR code to be restored, M allows 15%, Q allows 25%, H allows 30%
        var margin = 4; // margin in rows/columns
 
        document.write(unescape('%3Cimg src="http://chart.apis.google.com/chart?chs='+chs+'&cht=qr&chl='+chl+'&choe='+choe+'&chld='+chld+'|'+margin+'" alt="QR Code" /%3E'));
</script>
It's work on this blog ;)

Links


QR generator


QR decoders


Libraries (Open Source)

  • ZXing - is an open-source, multi-format 1D/2D barcode reader library implemented in Java.
  • QR-code - library to output a image of QR-code on Perl or PHP

4 comments:

Omar Abid said...

hi here's a better one http://omarabid.com/barcode/online_qrcode.php

erasehiot said...

Thanks. Very good!

badboy said...

We have been trying to make what we think is a pretty good QRCode Encoder and would love to for people to check it out and see what they think.

MSKYNET Maestro

feha said...

Also automatic one:
http://urlgomo.com

:-)