📜 ⬆️ ⬇️

QR code and ways to integrate into blogs



Before you QR code (“Quick Response”) - this is a new generation of bar codes developed by the Japanese company Denso-Wave back in 1994, in order to replace the standard barcode, which could no longer satisfy all needs. At the moment, it is widely used in Japan and other Asian countries, and comes to us a little bit - at least take a look at the processor in your computer - it, too, is most likely marked with a 2D code.


Before the usual barcode, QR has a couple of significant advantages:

A QR code has versions, they differ in the amount of stored information and of course in size:

More detailed information can be found on the pages of Wikipedia (English), or even Habr
')
You can use the following services to generate a picture with a QR code:

One of the advantages of this code - it can be easily recognized using your mobile phone - just install the appropriate software:

Note : When generating the code, do not use the version above the fourth, because there is a large share of probability - that this will not be recognized by mobile phones.

For developers, "readers" - here is a link to the ZXing library for Java.

I also advise you to look at the site http://www.semapedia.org/ - they are now actively involved in the promotion of QR code ...

Further information for bloggers - if you want to diversify your blog - you can add a QR code to each post using one of the following methods:

QR Code plugin for Wordpress


Download: QR Code (version 0.1)

The plugin uses the QR-code library to generate an Open Source image (the images are added to the plugin directory).

To install you will need:
  1. Unpack the archive with the plugin in the directory / wp-content / plugins /
  2. Set write permissions for the / wp-content / plugins / a-qr-code / cache / directory
  3. Activate the plugin in the admin panel

And edit the topic a bit by adding the following code to the page.php, single.php, archive.php, index.php files (it is not necessary for you to choose everything):

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

This will add a QR code to the post (or page) in which the URL of the page will be encrypted.

The aQRCode function can take the following parameters:
  1. Data for encoding (string) - in the example, the string returned by the get_permalink () function was used
  2. The amount of data for the correction (string) - L (7%), M (15%), Q (25%) or H (30%)
  3. Format (string) - J - for jpeg and other - for PNG
  4. Size (integer) - up to 1480
  5. Version (integer) - from 1 to 40

QR Code plugin for Wordpress (Google Charts API version)


Download: QR Code (GCAPI) (version 0.1)

This method is based on the Google Charts API , and is very easy to install:
  1. Unpack the archive with the plugin in the directory / wp-content / plugins /
  2. Activate the plugin in the admin panel

Add the following code to the theme template:

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


The aQRCodeG function can take the following parameters:
  1. Data for encoding (string) - in the example, the string returned by the get_permalink () function was used
  2. Size (integer) - up to 546 pixels
  3. Encoding (string) - Shift_JIS, UTF-8 or ISO-8859-1
  4. The amount of data for the correction (string) - L (7%), M (15%), Q (25%) or H (30%)
  5. Indent (integer) - default 4 columns / lines


QR Code for Blogspot


Using this method, you can easily integrate the QR code into your blog on blogspot.com or on any other hosting, where you have the opportunity to insert the following JavaScript code into a page (this method is also based on the Google Charts API):

         // 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 area for all charts except maps is 300,000 pixels.  As many as 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'));

For blogspot.com you need to add a gadget called HTML / JavaScript , how it looks you can look at the blog php-team.blogspot.com

Source: https://habr.com/ru/post/37622/


All Articles