Home > Backend Development > PHP Tutorial > PHP method to generate color QR code based on QRCODE

PHP method to generate color QR code based on QRCODE

墨辰丷
Release: 2023-03-29 13:10:01
Original
4034 people have browsed it

This article mainly introduces the method of generating color QR codes with PHP QRCODE, and briefly analyzes the relevant parameter setting skills of phpqrcode files for generating color QR codes. Friends in need can refer to it

Here Rewrote PHPQRCODE, streamlined some codes, and merged the output of PNG, GIF, and JPEG.

Parameter description:

Calling method:

Copy code The code is 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 Size of each pixel
$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] Center of the upper left corner array(r,g,b)
[5] Upper right corner center array(r,g,b)
[6] Lower left corner center array(r,g,b)
[7] Content array(r,g,b)
[8] Whether the content color changes // No code has been written yet, keep

$margin = 2 // Surrounding margin
$saveandprint=false

$outfile is true Whether to output simultaneously

$logo=false LOGO图像地址 //LOGO高大于宽自动裁剪 圆角透明没写好
$bg=false //背景图像数组
Copy after login

[0] Image address
[1] Background width 0 is unchanged
[2] Background height 0 is to maintain aspect ratio
[3 ] The ratio of the smallest value of the width of the LOGO to the width and height of the background is 0.8, which is 80%
[4] If the left margin of the LOGO is 0 from the background, it will be centered and the right side will automatically move to the left.
[5] The margin of the LOGO will be 0 from the top margin of the background. For centering, the lower edge will automatically go up if it exceeds

$type='png' Output type PNG GIF JPG

Summary: The above is the entire content of this article, I hope it can help everyone learn Helps.

Related recommendations:

How to implement fuzzy query in PHP

Compatible with php5 and cURL file upload function of php7

phpSimple example sharing of adding data to xml file

The above is the detailed content of PHP method to generate color QR code based on QRCODE. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template