chillerlan / php-qrcode

A PHP QR Code generator and reader with a user-friendly API.
https://smiley.codes/qrcode/
Apache License 2.0
2.01k stars 302 forks source link

PHP Fatal Error - Memory limit #203

Closed kihanb closed 1 year ago

kihanb commented 1 year ago

I tried to scan this photo (Instagram QR code): https://www.uplooder.net/img/image/83/4ed519015890ec62a30d54af680415d1/kihanb-qr.png

but I got this php faal error:

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 67108872 bytes) in /home1/vendor/chillerlan/php-qrcode/src/Decoder/LuminanceSourceAbstract.php on line 77

I aslo tried to increase the memory limit but didn't work:

PHP Fatal error: Allowed memory size of 419430400 bytes exhausted (tried to allocate 268435464 bytes) in /home1/vendor/chillerlan/php-qrcode/src/Decoder/LuminanceSourceAbstract.php on line 77

codemasher commented 1 year ago

Try resizing the input image to a smaller size before attempting to read the QR Code. On a side note: I'd suggest to crop the image so that it only contains the QR.