khanamiryan / php-qrcode-detector-decoder

This is a PHP library to detect and decode QR-codes. This is first and only QR code reader that works without extensions.
Apache License 2.0
1.37k stars 324 forks source link

php-mbstring is not mentioned #142

Open BlackMage2 opened 1 year ago

BlackMage2 commented 1 year ago
$ php8.1 -f my-php-qrcode-reader.php 
PHP Fatal error:  Uncaught Error: Call to undefined function Zxing\imagecreatefromstring() in /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php:46
Stack trace:
#0 /home/user/Development/my-php-qrcode-reader/my-php-qrcode-reader.php(4): Zxing\QrReader->__construct()
#1 {main}
  thrown in /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php on line 46

why this error occurs? did I forget something?

with that simple code:

<?php
require __DIR__ . "/vendor/autoload.php";
use Zxing\QrReader;
$qrcode = new QrReader('IMG-0069.jpg');
$text = $qrcode->text(); //return decoded text from QR Code
?>

i have executed that in the project directory:

composer require khanamiryan/qrcode-detector-decoder

BlackMage2 commented 1 year ago

okay, i have now installed the apt package php8.1-gd, now

PHP Fatal error:  Uncaught Error: Call to undefined function Zxing\Qrcode\Decoder\mb_detect_encoding() in /home/sven/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php:321
Stack trace:
#0 /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php(111): Zxing\Qrcode\Decoder\DecodedBitStreamParser::decodeByteSegment()
#1 /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php(179): Zxing\Qrcode\Decoder\DecodedBitStreamParser::decode()
#2 /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php(50): Zxing\Qrcode\Decoder\Decoder->decodeParser()
#3 /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php(102): Zxing\Qrcode\Decoder\Decoder->decode()
#4 /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php(48): Zxing\Qrcode\Decoder\Decoder->decodeBits()
#5 /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/QRCodeReader.php(63): Zxing\Qrcode\Decoder\Decoder->decode()
#6 /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php(91): Zxing\Qrcode\QRCodeReader->decode()
#7 /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php(100): Zxing\QrReader->decode()
#8 /home/user/Development/my-php-qrcode-reader/my-php-qrcode-reader.php(5): Zxing\QrReader->text()
#9 {main}
  thrown in /home/user/Development/my-php-qrcode-reader/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php on line 321

occurs

ok, mbstring seems missing

BlackMage2 commented 1 year ago

with installing apt package php8.1-mbstring all works :D

php8.1-gd was too required

msEmmaMays commented 1 year ago

It says GD is required in the Readme.MD - can you close this please?

BlackMage2 commented 1 year ago

no, php-gd AND php-mbstring is required. mbstring is not mentioned