PHP QR Code Barcode and two-dimensional code generation class library

Source: Internet
Author: User
//生成带logo的二维码图片
  1. Include ' phpqrcode.php ';
  2. $value = ' http://www.cnblogs.com/txw1958/'; Two-dimensional code content
  3. $errorCorrectionLevel = ' L ';//Fault tolerance level
  4. $matrixPointSize = 6;//Generate picture size
  5. Generate two-dimensional code images
  6. QRCode::p ng ($value, ' qrcode.png ', $errorCorrectionLevel, $matrixPointSize, 2);
  7. $logo = ' logo.png ';//Ready logo image
  8. $QR = ' qrcode.png ';//The original two-dimensional code diagram that has been generated
  9. if ($logo!== FALSE) {
  10. $QR = imagecreatefromstring (file_get_contents ($QR));
  11. $logo = imagecreatefromstring (file_get_contents ($logo));
  12. $QR _width = Imagesx ($QR);//QR code image width
  13. $QR _height = Imagesy ($QR);//QR code image Height
  14. $logo _width = Imagesx ($logo);//logo Picture width
  15. $logo _height = Imagesy ($logo);//logo Picture height
  16. $logo _qr_width = $QR _width/5;
  17. $scale = $logo _width/$logo _qr_width;
  18. $logo _qr_height = $logo _height/$scale;
  19. $from _width = ($QR _width-$logo _qr_width)/2;
  20. Regroup and resize pictures
  21. Imagecopyresampled ($QR, $logo, $from _width, $from _width, 0, 0, $logo _qr_width,
  22. $logo _qr_height, $logo _width, $logo _height);
  23. }
  24. Output picture
  25. Imagepng ($QR, ' \helloweixin.png ');
  26. Echo ';
Copy Code
Class Library, PHP
  • 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: info-contact@alibabacloud.com 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.