escpos-php
escpos-php copied to clipboard
PHP 8.0 GdEscposImage::readImageFromGdResource($im) Failed to load image.
PHP 8.0: GdImage class objects replace GD image resources.
This works for me.
if (!is_resource($im) && !is_object($im)) { throw new Exception("Failed to load image."); } ...... .................
Hi!
We need this commit to get into master and be able to use it via composer. I see the build failed, but I guess it's an false positive?
Bug is GdEscposImage:61
if (!is_resource($im)) { throw new Exception("Failed to load image."); ...
Why not is a resource?
Please repair bug in php 8
If anyone else is using PHP8, and is getting this error, I would recommend to reference directly to the development branch, because this error is already resolved in the PR https://github.com/mike42/escpos-php/pull/1042
The easy way to do this would be to just execute the following lines:
composer remove mike42/escpos-php --update-with-dependencies
composer require mike42/escpos-php:dev-development
Note: This is actually not recommended, because referencing a branch in active development can be unreliable, and yield different results in CI pipelines, but, is useful if you need a quick solution,
If you want a little bit more of stability, you can reference the specific commit:
# Instead of
composer require mike42/escpos-php:dev-development
# Do
composer require mike42/escpos-php:dev-development#f414320fc510afcacd4cbb75902f827399dee429