PHP QR Code 条形码和二维码生成类库

WBOY
Freigeben: 2016-07-25 08:42:18
Original
1378 Leute haben es durchsucht
//生成带logo的二维码图片
  1. include 'phpqrcode.php';
  2. $value = 'http://www.cnblogs.com/txw1958/'; //二维码内容
  3. $errorCorrectionLevel = 'L';//容错级别
  4. $matrixPointSize = 6;//生成图片大小
  5. //生成二维码图片
  6. QRcode::png($value, 'qrcode.png', $errorCorrectionLevel, $matrixPointSize, 2);
  7. $logo = 'logo.png';//准备好的logo图片
  8. $QR = 'qrcode.png';//已经生成的原始二维码图
  9. if ($logo !== FALSE) {
  10. $QR = imagecreatefromstring(file_get_contents($QR));
  11. $logo = imagecreatefromstring(file_get_contents($logo));
  12. $QR_width = imagesx($QR);//二维码图片宽度
  13. $QR_height = imagesy($QR);//二维码图片高度
  14. $logo_width = imagesx($logo);//logo图片宽度
  15. $logo_height = imagesy($logo);//logo图片高度
  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. //重新组合图片并调整大小
  21. imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width,
  22. $logo_qr_height, $logo_width, $logo_height);
  23. }
  24. //输出图片
  25. imagepng($QR, '\helloweixin.png');
  26. echo 'PHP QR Code 条形码和二维码生成类库 ';
复制代码

类库, PHP


Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!