SimpleSoftwareIO / simple-qrcode

An easy-to-use PHP QrCode generator with first-party support for Laravel.
https://www.simplesoftware.io/simple-qrcode
MIT License
2.72k stars 383 forks source link

Imagick extension not working with Laravel 10 and PHP 8.2 #289

Closed reshmindp closed 1 year ago

reshmindp commented 1 year ago

When trying to create QR code using simplesoftwareio/simple-qrcode 4.2 getting the below error. Please fix this support issue. BaconQrCode\Exception\RuntimeException: You need to install the imagick extension to use this back end in file

SimplyCorey commented 1 year ago

You need to install imagick or use svg qrcodes.

subdesign commented 10 months ago

Not so easy. Same error on Laravel 9/10, PHP 8.0, 8.1, 8.2 , MacOS 12 , Laravel Valet 4.5.0 simple-qrcode ^4.2

Imagick installed (PHP Monitor) #1:

Screenshot 2023-11-14 at 10 49 01

2 php.ini:

Screenshot 2023-11-14 at 10 50 03

3 Tinkerwell test:

Screenshot 2023-11-14 at 10 50 59

ImageMagickBackEnd.php in bacon-qrcode, drops exception:

    public function __construct(string $imageFormat = 'png', int $compressionQuality = 100)
    {
        if (! class_exists(Imagick::class)) {
            throw new RuntimeException('You need to install the imagick extension to use this back end');
        }
        ...

original call:

QrCode::format('png')->size(300)->margin(3)->generate($this->qrcode, $qrcode_image_path);

So any idea?

EDIT: if I directly call the bacon qrcode in the project, it works, creates the png:

    Route::get('qrtest', function(){
        $renderer = new ImageRenderer(
            new RendererStyle(400),
            new ImagickImageBackEnd()
        );
        $writer = new Writer($renderer);
        $writer->writeFile('Hello World!', base_path('qrcode2.png'));
    });
hihebark commented 2 months ago

Same issue here, same php and laravel version!