PHP TP generates two-dimensional code

Source: Internet
Author: User

  Vendor (' Phpqrcode.phpqrcode ');        $value = "";//QR code content $errorCorrectionLevel = ' L ';//tolerance level $matrixPointSize = 6;//Generate picture size        Generate two-dimensional code picture \qrcode::p ng ($value, ' qrcode.png ', $errorCorrectionLevel, $matrixPointSize, 2); $logo = ' logo15.png ';///Ready logo image $QR = ' qrcode.png ';//The original two-dimensional code diagram already generated if ($logo!== FALSE) {$QR = i            Magecreatefromstring (file_get_contents ($QR));            $logo = imagecreatefromstring (file_get_contents ($logo)); $QR _width = Imagesx ($QR);//QR code image width $QR _height = Imagesy ($QR);//QR code image height $logo _width = imagesx ($logo);            Logo image width $logo _height = Imagesy ($logo),//logo image height $logo _qr_width = $QR _width/8;            $scale = $logo _width/$logo _qr_width;            $logo _qr_height = $logo _height/$scale;            $from _width = ($QR _width-$logo _qr_width)/2; Regroup the picture and resize imagecopyresampled ($QR, $logo, $from _width, $from _width, 0, 0, $logo _qr_width, $logo _qr_height, $logo _width, $logo _height);        } $path = './public/pay_img/';            if (!is_dir ($path)) {$r = mkdir ($path, 0777, true);            if (! $r) {$this->error (' Create folder failed '); }}//Output picture imagepng ($QR, MD5 (Time ()).        PNG '); $file = './'. MD5 (Time ()). PNG '; Old directory $newFile = $path. MD5 (Time ()). PNG '; New directory Copy ($file, $newFile); Copy to the new directory unlink ($file);        Delete the file under the old directory $path = substr ($path, 1); $IMGSRC = $path. MD5 (Time ()). ". PNG ";


Two-dimensional code class

PHP TP generates two-dimensional code

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.