PHP identification QR code (php-zbarcode

Source: Internet
Author: User

 PHP identification QR code (PHP-ZBARCODE)Tags: php two-dimensional code extension2015-11-06 17:12 609 People read comments (0) favorite reports Classification:PHP (1)Linux

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Description: Extensions need to rely on ImageMagick and Zbar to install both software  1 before installation. Installation ImageMagick (http://www.imagemagick.org/)  yum Install imagemagick.x86_64 imagemagick-devel.x86_64 2. Installing the Zbar (http://sourceforge.net/projects/zbar/?source= directory)   wget http://jaist.dl.sourceforge.net/project/zbar/zbar/0.10/zbar-0.10.tar.bz2  Tar jxvf zbar-0.10.tar.bz2 cd zbar-0.10  #注意此步有大坑, to prohibit Gtk,python and QT support, otherwise you will wait for infinite error./configure-- WITHOUT-GTK--without-python--without-qt--prefix=/usr/local/zbar make && make install  #提示如下为完成, Not an error #make[2]: Leaving directory '/root/zbar-0.10 ' #make [1]: Leaving directory '/root/zbar-0.10 ' #echo "/usr/local/zbar/ lib/">>/etc/ld.so.conf  ldconfig  ln-s/usr/local/zbar/lib/pkgconfig/zbar.pc  / Usr/lib64/pkgconfig/zbar.pc 3. Installing Php-zbarcode (Https://github.com/mkoppanen/php-zbarcode)  unzip PHP-ZBARCODE-MASTER.ZIP  CD Php-zbarcode-master /usr/local/php/bin/phpize ./configure-- with-php-config=/usr/Local/php/bin/php-config make && make install  #提示如下完成 #build complete. #Don ' t forget-run ' make test ' .  #Installing Shared extensions:    /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/  4. Add: extension=zbarcode.so to php.ini profile   View Phpinfo at this time, after searching Zbarcode for completion  5. Test results   pictures taken from https:// En.wikipedia.org/wiki/file:ean-13-5901234123457.png[PHP]View PlainCopy
  1. <?php
  2. //Create a new Image object
  3. $image = new Zbarcodeimage ("./test.png");
  4. //Create a two-dimensional code recognizer
  5. $scanner = new Zbarcodescanner ();
  6. //Image recognition
  7. $barcode = $scanner->scan ($image);
  8. //Cyclic output QR code information
  9. if (! Empty ($barcode)) {
  10. foreach ($barcode as $code) {
  11. printf ("Found type%s barcode with Data%s\n", $code [' type '], $code [' data ']);
  12. }
  13. }
  14. ?>

PHP identification QR code (php-zbarcode

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.