mkoppanen / php-zbarcode

PHP extension for reading barcodes. Uses ImageMagick(http://www.imagemagick.org/) for image support and zbar(http://zbar.sourceforge.net/) for scanning the barcodes.
http://valokuva.org
383 stars 131 forks source link

i installed zbarcode successfully.but Imagick and GD doesn`t support . #25

Closed duanghuang closed 2 years ago

duanghuang commented 7 years ago

phpinfo() shows:

zbarcode

zbarcode module enabled
zbarcode module version 0.0.1-dev
ZBar library version    0.10
ImageMagick version ImageMagick 6.9.6-2 Q16 x86_64 2016-10-11 http://www.imagemagick.org
Imagick support disabled
GD support  disabled
$image = new ZBarCodeImage("img.jpg");

        /* Create a barcode scanner */
        $scanner = new ZBarCodeScanner();

        /* Scan the image */
        try{
            $barcode = $scanner->scan($image);
        }catch(Exception $e) {
            echo 'Caught exception: ',  $e->getMessage(), "\n";
        }

it Interrupts at $barcode = $scanner->scan($image); and i can`t catch the error..

nardist01 commented 7 years ago

you just need change some code https://github.com/jorissteyn/php-zbarcode/commit/a95e63949bfc3704683dda3cf085a6e402e41eee#diff-2a39a617e0ba8460672c93ad732d6637 and configure with flags ./configure --enable-zbarcode-imagick --enable-zbarcode-gd