PHP generation with logo of the QR code, perhaps a lot of experts have been implemented, but did not pay much attention to this aspect, this paragraph has a small project to use the two-dimensional code generation, index to check some information, send some have a PHP class library Phpqrcode to generate this two-dimensional code is very convenient, the index tested a bit, Below to use their own usage and code to share with the novice, I hope the master encouragement Oh.
Build effect: Logo image in the middle
First you need to download this class library package, or I will attach this class library behind, the specific use of code:
1, the basic two-dimensional code generation unit, the direct output of the standard two-dimensional code:
2, the generation of standard QR code and logo of the two-dimensional code:
"; $logo = ' emwlogo.gif ';//needs to be displayed in the QR Code of the logo image $qr = ' ewmlogo.png ';//generate a logo with a QR code file name if ($logo!== FALSE) {$QR = Imagecreatef Romstring (file_get_contents ($QR)); $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 _heig HT);} Imagepng ($QR, ' ewmlogo.png ');? >
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The above describes the PHP combined with Phpqrcode to generate a picture logo QR code, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.