Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.0 GdEscposImage::readImageFromGdResource($im) Failed to load image. #1007

Open
osiams opened this issue Dec 16, 2020 · 4 comments
Open
Labels
Milestone

Comments

@osiams
Copy link

osiams commented Dec 16, 2020

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.");
} ......
.................

lfelizari added a commit to lfelizari/escpos-php that referenced this issue Jan 16, 2021
Implemented sugestion from 👍 mike42#1007
@adydeac
Copy link

adydeac commented Jan 21, 2021

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?

@mike42 mike42 added the bug label Mar 8, 2021
@mike42 mike42 added this to the 4.0 milestone Mar 8, 2021
@joseantoniopino
Copy link

joseantoniopino commented Jun 10, 2021

Bug is GdEscposImage:61

if (!is_resource($im)) { throw new Exception("Failed to load image."); ...
Why not is a resource?

@nGincode
Copy link

Please repair bug in php 8

@thblckjkr
Copy link

thblckjkr commented Feb 7, 2022

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 #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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants