PHP combined with Phpqrcode to generate two-dimensional code with image logo

Source: Internet
Author: User
Tags php class
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.

  • 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: 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.