Giter Club home page Giter Club logo

php-qrcode-detector-decoder's Introduction

Hi there 👋

php-qrcode-detector-decoder's People

Contributors

0test avatar andreybolonin avatar bitdeli-chef avatar chris8934 avatar duncan3dc avatar genietim avatar ilario-pierbattista avatar interinvest avatar jk2k avatar khanamiryan avatar limingxinleo avatar marikn avatar philipp-brosig avatar qhxin avatar remicollet avatar renat-magadiev avatar samnela avatar seldaek avatar webmaster777 avatar xiabeifeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-qrcode-detector-decoder's Issues

file_get_contents(picture.png): failed to open stream

I got a problem and it says

Warning: file_get_contents(test.png): failed to open stream: No such file or directory in D:\xxx\htdocs\test\vendor\khanamiryan\qrcode-detector-decoder\lib\QrReader.php on line 34

I put image files on D:\xxx\htdocs\test\vendor\khanamiryan\qrcode-detector-decoder\lib directory.

Any idea?

QRcode not decoding getting blank response

I am trying to decode QR code image which is photo or screenshot taken from mobile phone/computer , but getting blank response. In short it is not working from any type of photo taken from Mobile/Computer.

Please resolve my issue ASAP.

Thanks in advance

throw new InvalidArgumentException must be prefixed with \ because of namespace?!

There are around 25 occurrences of throw new InvalidArgumentException in the source code all of them within namespaced classes. So it should be throw new \InvalidArgumentException! Or am I wrong with something?

See http://stackoverflow.com/a/22664893/22470

One of my error messages:
Fatal error: Class 'Zxing\Qrcode\Decoder\InvalidArgumentException' not found in /www/vendors/php-qrcode-detector-decoder/qrcode/decoder/Version.php on line 121

Wrong result

This file can not be decoded with QrReader! it just returns (bool)false. But the text encoded in the QR Code is w_537244_40.

$QrReader = new QrReader('wrong.png');
echo $QrReader->text();

wrong

The correct result can be proved with the online Zxing.org encoder here. It returns:

Raw text              w_537244_40
Raw bytes             40 27 75 f1 01 a1 93 d1   00 d7 cd 0c 00 ec 11 ec
Barcode format        QR_CODE
Parsed Result Type    TEXT
Parsed Result         w_537244_40

读取不了图片

图片如果使用相对路径就报错,使用绝对路径就502了

Getting bool(false) as result

using same code as mentioned.

text(); //return decoded text from QR Code var_dump($text); ?>

returning bool(false)

private $dataWidth =>
int(1021)
private $dataHeight =>
int(2459)
private $left =>
int(0)
private $top =>
int(0)
private $image =>
class Imagick#42 (0) {
}
private $width =>
int(1021)
private $height =>
int(2459)
}
class QrReader#41 (1) {
public $result =>
bool(false)
}

bool(false)

Any help on what is going wrong?

Get content, this is return false

HI!
The QR code image cannot be expanded if it is enlarged.

$qrcode = new QrReader($file_path);
$qrcode->text() // return false

Get content, this is return false。How can I solve this?

The following two are the same QR code

eg1: success
1111

eg2: false
2222

Class not found: Example missing namespace

You cannot call "new QrReader('image.jpg')" because the class is not found. You need to add "Zxing" before it, like below:

$qrcode = new Zxing\QrReader('barcode.jpg');

Support for Aztec

The original library supports reading Aztec codes (2d), can we have support for that?

File Size

We have implemented this library and we realized that the issues we were having with not being able to read the QR code are related to the size of the images uploaded.

Since we are accessing the device camera we have limitations on reducing the file size easily. What's the best way to reduce the files sizes before decoding the image.

Composer Install: File could not be downloaded 404

$ composer require -vvv khanamiryan/qrcode-detector-decoder
...
Downloading http://repo.packagist.org/p/provider-2019-04%2444b1950ccd1436493c71087c82e1d7a63231808704231e7b9b10debef51896c3.json

Following redirect (2) https://packagist.org/p/provider-2019-04%2444b1950ccd1436493c71087c82e1d7a63231808704231e7b9b10debef51896c3.json
Downloading https://packagist.org/p/provider-2019-04%2444b1950ccd1436493c71087c82e1d7a63231808704231e7b9b10debef51896c3.json

                                                                                                                                                           
  [Composer\Downloader\TransportException]                                                                                                                 
  The "https://packagist.org/p/provider-2019-04%2444b1950ccd1436493c71087c82e1d7a63231808704231e7b9b10debef51896c3.json" file could not be downloaded (HT  
  TP/1.1 404 Not Found)                                                                                                                                    
                                                                                                                                                           

Exception trace:
 () at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Util/RemoteFilesystem.php:438
 Composer\Util\RemoteFilesystem->get() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Util/RemoteFilesystem.php:876
 Composer\Util\RemoteFilesystem->handleRedirect() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Util/RemoteFilesystem.php:428
 Composer\Util\RemoteFilesystem->get() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Util/RemoteFilesystem.php:104
 Composer\Util\RemoteFilesystem->getContents() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Repository/ComposerRepository.php:683
 Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Repository/ComposerRepository.php:595
 Composer\Repository\ComposerRepository->loadProviderListings() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Repository/ComposerRepository.php:315
 Composer\Repository\ComposerRepository->whatProvides() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/DependencyResolver/Pool.php:204
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/DependencyResolver/Pool.php:193
 Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Package/Version/VersionSelector.php:52
 Composer\Package\Version\VersionSelector->findBestCandidate() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Command/InitCommand.php:705
 Composer\Command\InitCommand->findBestVersionAndNameForPackage() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Command/InitCommand.php:401
 Composer\Command\InitCommand->determineRequirements() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Command/RequireCommand.php:136
 Composer\Command\RequireCommand->execute() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Console/Application.php:258
 Composer\Console\Application->doRun() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///usr/local/Cellar/composer/1.8.5/bin/composer/bin/composer:61
 require() at /usr/local/Cellar/composer/1.8.5/bin/composer:24

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

Fix repository description

The repository description states This is first and only QR code reader that works without extensions. however this is false since this requires the GD Extension.

Decode img from canvas

I dont use yet ur lib, but one thing.... i used the camera of mobiles smartphones, to catch the QR Code and i input the file into a canvas..... I dont' know if this is possible, but its very nice if i can send (POST) the image into ur PHP and they answer me with the QRCode in text format... What do u thing about this ?

InvalidArgumentException in getProvisionalVersionForDimension

This is failing with an image of 113px (I've tried with 120px and 200px):

// $topLeft = [x: 255, y: 100]
// $topRight = [x: 204, y: 106.5]
// $bottomLeft = [x: 204, y: 61]
// $moduleSize = 3.7482654545842
// $tltrCentersDimension = 6
// $tlblCentersDimension = 12
// $dimension = 16
$dimension =(int) $this->computeDimension($topLeft, $topRight, $bottomLeft, $moduleSize);
// $dimension = 17
Version::getProvisionalVersionForDimension($dimension);

That raises an exception:

self::getVersionForNumber(($dimension - 17) / 4);

    public  static function getVersionForNumber($versionNumber)
    {
        if ($versionNumber < 1 || $versionNumber > 40) {
            throw new \InvalidArgumentException();
        }

What can I do to solve this problem?

License issue

1/ License inconsistency

In composer.json

"license": "MIT",

But most of files have

* Licensed under the Apache License, Version 2.0 (the "License");

Some files don't have LIcense headers

2/ LICENSE file missing

This is expected to allow downstream distribution

More information, see https://fedoraproject.org/wiki/Packaging:LicensingGuidelines?rd=Packaging/LicensingGuidelines#License_Text

Common licenses that require including their texts with all derivative works include ASL 2.0, EPL, BSD and MIT.

Please include a LICENSE file

Per common best practice

BTW, according to composer.json, this is MIT
But some file have ASL 2.0 license headers

Need to be clarified.

exception 'yii\base\ErrorException'

exception 'yii\base\ErrorException' with message 'syntax error, unexpected ':', expecting ';' or '{'' in /vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php:77 Stack trace: #0 [internal function]: yii\base\ErrorHandler->handleFatalError() #1 {main}

Fatal error: Class 'QrReader' not found

Hello, downloaded this project composer but i cant found example file so i made a test.php file on root folder and use sample code like this.

<?php

require __DIR__ . "/vendor/autoload.php";
$qrcode = new QrReader('path/to_image');
$text = $qrcode->text(); //return decoded text from QR Code

?>

After then i had this error message: "Fatal error: Class 'QrReader' not found"

Any souliton for this or is have an example php?

NOT WORKING FOR Android mobile 8 MP Camera image

Hi,
I was trying to upload image captured by mobile (Android mobile 8 MP Camera) But Its not working then I tried that image from direct upload from desktop still not working. In short Its not working for QR code Image captured by mobile.

Please resolve my issue ASAP.

Thanks in advance

Work with tmp_file

I'm trying to use this library with a picture send by a form POST.
I don't want to save it to the server, and I want to use the temporary storage :

$qrScreenPath = $_FILES['file']['tmp_name'];        
$qrcode = new Zxing\QrReader($qrScreenPath);
$text = $qrcode->text(); //return decoded text from QR Code

but I get this warning error :

imagecreatefromstring() : No JPEG support in this PHP build.

Does it a normal behavior of the library?

PS : I tried with a local picture, it works.

PHP 7
GD Library Enabled

README wrong instructions

I've been spending some large minutes until I found it should be:

$ composer require khanamiryan/qrcode-detector-decoder:dev-master

Otherwise it says no stable version found. I suppose that this will be happening until a release has been published in github.

Memory usage

Hello,

i started looking into this detector-decoder and it works really well for small images, the problem is once i get to bigger images,

i want to be able to find a QR code within an image, for example if someone is holding a QR code while having their photo taken.

is there an know memory problem when using big images?

thank you
Jamie

Exception 'InvalidArgumentException' in Qrcode/Decoder/Version.php:121

Use:
$qrcode = new QrReader($img);
$text = $qrcode->text();
var_dump($text);

Error:
[InvalidArgumentException] exception 'InvalidArgumentException' in Qrcode/Decoder/Version.php:121

Qrcode/Decoder/Version.php:121 ->
/**
*

Deduces version information purely from QR Code dimensions.


*
* @param dimension dimension in modules
* @return Version for a QR Code of that dimension
* @throws FormatException if dimension is not 1 mod 4
*/
public static function getProvisionalVersionForDimension($dimension)
{
if ($dimension % 4 != 1) {
throw FormatException::getFormatInstance();
}
try {
return self::getVersionForNumber(($dimension - 17) / 4);
} catch (InvalidArgumentException $ignored) {
throw FormatException::getFormatInstance();
}
}

Division by Zero Warning

Hi khanamiryan,

I get a infinite loop with following message:

" Warning : Division by zero in C : \ xampp \ htdocs \ qrcodereader \ lib \ common \ customFunctions.php on line 18 "

The GD Library and PHP version > = 5.3 is installed.

I am doing something specific wrong?

syntax error, unexpected '(' in /var/www/app/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php on line 43

Hello,

My dev and prod environment is Ubuntu 14.

Dev is running PHP 7.1.8-2+ubuntu14.04.1+deb.sury.org+4 while prod is running PHP 7.0.24-1+ubuntu14.04.1+deb.sury.org+1

This error is thrown in production but not in dev.

I had previously logged this issue in Usuario #207 (2amigos/yii2-usuario#207) because that project uses this as a dependency but it was closed so it can be properly logged here.

Could someone please review and comment, thanks

You hade a CharacterSetECI bug in your system

Hi I'm building a aplication fon transfer files using qr code but when i found your library, i notice that was missing to files and i fixed the bug there you have the files.

The location is : /lib/common/
->CharacterSetEci.php
->AbstractEnum.php
And replace your : /lib/QrReader.php
by mine, i just updated the include of the files.

fallow location whith the help: https://www.dropbox.com/s/uo1pvx8fhga8h9m/phpQrReader.pdf?dl=0
the new zip compilation -> https://www.dropbox.com/s/ig6rf33zabohp2g/phpQrDecoder.zip?dl=0

Parse error in lib/Qrcode/QRCodeReader.php on line 190

Parse error: syntax error, unexpected '=' in /var/www/fairwarning_app/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/QRCodeReader.php on line 190

You have: [$x, $y] = $leftTopBlack;

Should be: list($x, $y) = $leftTopBlack;

No use of semver for new release (1.0.1)

In version 1 the class QrReader is in the root namespace. In version 1.0.1 it has moved to namespace Zxing. The change was introduced in 4f4e165. Are you supporting semver (https://semver.org/)? It is the default for composer packages. If you do not use it, it might be worthwhile to include a statement about the policy followed in your readme.md.

Tag a new release

Could you create a new tag for a composer release?

Maybe 0.1.0 would be a good idea while the improvements from #21 are gradually included.

That way people can rely on 0.1.* until they are ready to move to namespaces, etc in later versions

Failed Install From Composer

@khanamiryan hello, when i try install this plugin using composer with run this

composer require khanamiryan/qrcode-detector-decoder

I got error,

[InvalidArgumentException]
Could not find package khanamiryan/qrcode-detector-decoder at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

How should i do?

not work

can't work

error:

object(QrReader)#41 (1) { ["result"]=> bool(false) }
qr

QR Code Decoding

Hello My Friend,

Thanks for sharing such a nice code base for qrcode. I am using this to decode some of my QR codes.

But it is not showing any decoded text for these QR images. Can you please help? I am attaching the QR code images. Though, I can decode your sample QR code image, It confirms that code is properly set.

I appreciate your help.

Look forward for your response.

Regards:
Rajeev
hello_world
hello_world123

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.