Generate QR codes using Google API tool:infographics

Source: Internet
Author: User

Google Developer provides the generation of QR code API, the following describes how to produce two-dimensional code, and related parameter settings.

Official Address: Https://google-developers.appspot.com/chart/infographics/docs/qr_codes

Here is an example code that uses the production QR code provided by Google Chart tools:

<?php//uses Google API tool to generate two-dimensional code function CREATEQR ($chlData, $chsWidth = $chsHeight, $choe = "UTF-8", $chld = AR Ray (' L ', 4)) {$base = ' https://chart.googleapis.com/chart? '; $cht = ' qr '; $get = $base. ' Cht= '. $cht. ' &chs= '. $chsWidth. ' X '. $chsHeight. ' &chl= '. $chlData. ' &choe= '. $choe. ' &chld= '. $CHLD [0]. ' | '. $CHLD [1];return $get;} $url = CREATEQR ($chlData = UrlEncode (' http://aiilive.blog.51cto.com ')); Echo ' 


The resulting QR code such as:

650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M02/47/DE/wKioL1QBtEWhr0xeAAAnwOICark031.jpg " Title= "Goole.chart.api-qr.png" alt= "wkiol1qbtewhr0xeaaanwoicark031.jpg"/>

can view Official Documents , the following is a simple description of the parameters that need to be set in the API process.

Parameters Necessity Description
Cht=qr True Specify a QR code
chs=< Width>x Two-dimensional code picture maximum size
chl=< Data>
true

Data URL encoded

choe=< Output_encoding> false

The encoding format of the data in the QR code, the main available formats are:

utf-8 ( Default), Shift-jis,iso-8858-1

Chld=<error_correction_level>|<margin>

False

Error_correction_level: The level of fault tolerance is four levels, respectively: L,m,q,h representation

Margin: The resulting two-dimensional code picture and border margin, but here does not have to be like the expression, but the line. Default 4


We're using Google's API to generate QR codes that don't take into account the amount and version of the code, which Google did. There are two connections, detailed information about the QR and standard instructions.

http://www.qrcode.com/zh/about/version.html

http://www.qrcode.com/en/codes/

From or code.com

650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/47/DC/wKiom1QBu0rgrx2aAAMI7cWpilw085.jpg " Title= "Qr.png" width= "680" height= "262" border= "0" hspace= "0" vspace= "0" style= "width:680px;height:262px;" alt= " Wkiom1qbu0rgrx2aaami7cwpilw085.jpg "/>

Google also provides a library of QR Code reader classes:Zerbar cross Zxing. Github: https://github.com/zxing/zxing


my other article about using zxing to generate two-dimensional code: http://aiilive.blog.51cto.com/1925756/1352004

This article from "Mustang Red" blog, declined reprint!

Generate QR codes using Google API tool:infographics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.