Use google api to generate a QR code business card example

Source: Internet
Author: User
Tags mixed vcard


Two-dimensional barcode/two-dimensional barcode can be divided into stacked/row-layout two-dimensional barcode and matrix two-dimensional barcode. Stacked/row-lined two-dimensional bar codes are stacked by one-dimensional bar codes with multiple lines of short cut; matrix two-dimensional bar codes are composed of matrices, in the corresponding element position of the matrix, "point" indicates the binary "1", and "null" indicates the binary "0", "point" and "null" to form the code.

Stacked/row-based two-dimensional bar codes, such as Code 16 K, Code 49, and Code 417.

Matrix qr code is the most popular one.

The matrix QR code stores a larger amount of data. It can contain numbers, characters, Chinese text, and other mixed content. It has a certain degree of fault tolerance (it can be read normally after some damages). It has a high space utilization rate.

The code is as follows: Copy code

 

<? Php
$ Vname = 'test ';
$ Vtel = '000000 ';
GenerateQRfromGoogle ($ vname, $ vtel );

Function generateQRfromGoogle ($ vname, $ vtel, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
{
If ($ vname & $ vtel ){
$ Chlorophyll = "BEGIN: VCARDnVERSION: 3.0". // vcard header information
"NFN: $ vname ".
"NTEL: $ vtel ".
"NEND: VCARD"; // vcard tail information
Echo ' ';
    }
}
?>

 

Php generates the url qr code:

The code is as follows: Copy code

<? Php
$ Url = "http://www.google.com.hk ";
GenerateQRfromGoogle ($ url );

Function generateQRfromGoogle ($ chlorophyll, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
{
Echo ' ';
}
?>

Example

The code is as follows: Copy code
<? Php
/*
* Generate a QR code business card in php
* Api Google
* Google api QR code generation [QRcode can store any text of a maximum of 4296 letters/numbers. For details, see the QR code data format]
* @ Param string $ information contained in the chlorophyll QR code, which can be numbers, characters, binary information, and Chinese characters. The data type cannot be mixed and must pass through the UTF-8 URL-encoded. If the information to be passed exceeds 2 K bytes, use the POST method
* @ Param int $ widhtHeight: set the size of the generated QR code
* @ Param string $ EC_level: the error correction level is optional. The QR code supports four levels of error correction, which is used to restore lost, read, fuzzy, and data.
* L-default: 7% of lost data can be identified.
* M-identifies 15% of data loss
* Q-identifies 25% of data loss
* H-identifies 30% of data loss
* @ Param int $ the distance between the QR code generated by margin and the image border
* Qr code business card format --- vcard
* The format is as follows:
BEGIN: VCARD
VERSION: 3.0
FN: User name
TEL; CELL; VOICE: 0571-00000000
TEL; WORK; VOICE: 0571-00000000
TEL; WORK; FAX: 0571-00000000
EMAIL; PREF; INTERNET: 361way
URL: http://www.111cn.net
OrG: 361way O & M path
ROLE: R & D department
TITLE: CTO
ADR; WORK; POSTAL: XXX, Xihu district, Hangzhou; 310000
REV: 2014-2-26T08: 30: 02Z
END: VCARD
If you want to customize the required format in more detail, you need to learn more about the format standard of vcard.
*/
$ Vcard = array (
'Vname' => 'username ',
'Vtel' => '123 ',
'Vemail' => 'aaaaa @ 163.com ',
'Vaddress' => 'Hangzhou Xihu District ',
);
GenerateQRfromGoogle ($ vcard );
Function generateQRfromGoogle ($ vcard, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
{
If ($ vcard ){
$ Chlorophyll = "BEGIN: VCARDnVERSION: 3.0". // vcard header information
"NFN:". $ vcard ['vname'].
"NTEL:". $ vcard ['vtele'].
"NEMAIL:". $ vcard ['vemail'].
"NADR:". $ vcard ['vaddress'].
"NEND: VCARD"; // vcard tail information
Echo ' ';
    }
}
?>

If you want to achieve the effect of a logo in the middle, you need to splice it with another logo thumbnail. Only one implementation method is provided here, and it can also be generated through QRcode.

For standard vcode information, see Wikipedia.

Note: Some generated images do not have scanned data because of encoding. This problem is common in windows. Many editors provide ANSI encoding by default, change to utf8 and then OK.

Related Article

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.