Closed sonqor closed 3 years ago
Hi @sonqor I can not reproduce this issue, but the error states that the imagecreatetruecolor($width, $height) function does not create a valid image resource so you have to look in that direction. For instance you could try calling the imagecreatetruecolor function yourself with some width and height (completely outside any qr code context) and see if it fails. If it does I really think something is wrong with your GD installation. Or maybe you could try some different width / heights or different PHP patch version (I had some issues myself on earlier PHP 8 versions). Please let me know if you have any new findings.
Hi @sonqor I can not reproduce this issue, but the error states that the imagecreatetruecolor($width, $height) function does not create a valid image resource so you have to look in that direction. For instance you could try calling the imagecreatetruecolor function yourself with some width and height (completely outside any qr code context) and see if it fails. If it does I really think something is wrong with your GD installation. Or maybe you could try some different width / heights or different PHP patch version (I had some issues myself on earlier PHP 8 versions). Please let me know if you have any new findings.
Hi.
I checked imagecreatetruecolor
with this code (from https://www.php.net/manual/en/function.imagecreatetruecolor.php)
No error occurred and the image created successfully.
But sorry me! Looks like I loaded wrong package version. I did a review of this article: https://github.com/endroid/qr-code/issues/282
Now, there is a new error:
[29-Mar-2021 21:22:14 UTC] PHP Fatal error: Uncaught TypeError: Endroid\QrCode\QrCode::setBackgroundColor(): Argument #1 ($backgroundColor) must be of type Endroid\QrCode\Color\ColorInterface, array given, called in index.php on line 18 and defined in qr4/vendor/endroid/qr-code/src/QrCode.php:156
Stack trace:
#0 index.php(18): Endroid\QrCode\QrCode->setBackgroundColor()
#1 {main}
thrown in qr4/vendor/endroid/qr-code/src/QrCode.php on line 156
I have this problem in PHP version 8.0.2 and endroid/qr-code 4.0.0.
Thank you for taking the time to respond to me.
@endroid
I took another brief look at the package documentation and realized that I had to use the Color class. So I changed the code like this: -> setBackgroundColor (new Color (255, 255, 255, 127));
Thanks again for your help.
Hey there! I was running my code on version 3.9.6 well.
As I updated the package to version 4.0.0, a PHP fatal error has thrown:
Any idea about this error? The PHP version is 8 and GD extension is installed and enabled (checked by phpinfo()). Also, I've tested GD. It works fine.