The method of generating color two-dimensional code in PHP qrcode _php skills

Source: Internet
Author: User

This article illustrates the method of generating color two-dimensional code in PHP QRCode. Share to everyone for your reference, specific as follows:

This rewrites the next phpqrcode, streamlining some of the code and merging the output of the PNG GIF JPEG.

Parameter description:

Call Mode:

Copy Code code as follows:
Qrcode::imgout ($text, $outfile = False, $level = qr_eclevel_l, $size = 3, $col =array (Array (255,255,255), Array (0,0,0)), $ Margin =2, $saveandprint =false, $logo =false, $bg =false, $type = ' png ');

$text string
$outfile = False

Output file

$level = L fault tolerance l 7% M 15% Q 25% H 30%
$size = 3 per pixel size
$col =array (Array (255,255,255), Array (0,0,0))

Color Multidimensional Array RBG

[0] Background color array (r,g,b)
[1] around the upper left corner Array (r,g,b)
[2] around the upper right corner array (r,g,b)
[3] around the lower left corner Array (r,g,b)
[4] upper left corner Array (r,g,b)
[5] upper right corner array (r,g,b)
[6] lower left corner Center Array (r,g,b)
[7] Content Array (r,g,b)
[8] The content color is changed/not write code, keep

$margin = 2//four perimeter distance
$saveandprint =false

Whether the output is simultaneous when the $outfile is true

$logo =false logo image address//logo tall in wide automatic clipping rounded corners transparent not written
$BG =false//Background image array

[0] Image address
[1] Background width 0 is unchanged
[2] Background high of 0 for keeping the width-height ratio
[3] The ratio of the logo width to the background width and the small value is 0.8 to 80%.
[4] logo from the background to the left margin 0 center to the right beyond the automatic left
[5] logo from the top edge of the background 0 to the center of the bottom outside the automatic upward

$type = ' png ' output type PNG GIF JPG

Phpqrcode file users can click here to enter the site download page: http://www.jb51.net/codes/189897.html

In addition, the site also provides a very powerful two-dimensional code generation tool for everyone to use free of charge:

Http://tools.jb51.net/transcoding/jb51qrcode

For more information on PHP related content readers can view the site topics: "PHP graphics and pictures Operating skills summary", "PHP array Operation techniques Encyclopedia", "PHP Sorting algorithm Summary", "PHP common traversal algorithm and skills summary", "PHP Data structure and algorithm tutorial", " PHP Programming algorithm Summary, "PHP Mathematical Calculation Skills Summary", "PHP Regular Expression Usage summary", "PHP operation and operator Usage Summary", "PHP string (String) Usage summary" and "PHP common database Operation skill Summary"

I hope this article will help you with the PHP program design.

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.