Php generates two-dimensional codes by using some plug-ins. Now we use phpqrcode to generate two-dimensional codes for all of our friends and add a watermark logo. The following is an example. Php generates two-dimensional codes by using some plug-ins. Now we use phpqrcode to generate two-dimensional codes for all of our friends and add a watermark logo. The following is an example.
Script ec (2); script
To provide a QR code interface for the mobile app, you must support iso, android, and win8 mobile phones. You have found the third-party tool phpqrcode.
1,
Source code download: https://github.com/t0k4rt/phpqrcode
2. Add watermark image and fragment code
| The Code is as follows: |
|
|
$ Logo = 'logo.png ';
If (is_file ($ logo ))
{
$ QR = imagecreatefromstring (file_get_contents ($ filename ));
$ Logo = imagecreatefromstring (file_get_contents ($ logo ));
$ QR_width = imagesx ($ QR );
$ QR_height = imagesy ($ QR );
$ Logo_width = imagesx ($ logo );
$ Logo_height = imagesy ($ logo );
$ Logo_qr_width = $ QR_width/5;
$ Scale = $ logo_width/$ logo_qr_width;
$ Logo_qr_height = $ logo_height/$ scale;
$ From_width = ($ QR_width-$ logo_qr_width)/2;
Imagecopyresampled ($ QR, $ logo, $ from_width, $ from_width, 0, 0, $ logo_qr_width, $ logo_qr_height, $ logo_width, $ logo_height );
Imagepng ($ QR, $ filename );
} |