JamesHeinrich / phpThumb

phpThumb() - The PHP thumbnail generator
Other
315 stars 97 forks source link

php v8.0 issues? #161

Closed dleffler closed 3 years ago

dleffler commented 3 years ago

Maybe it's my implementation, but phpThumb (always?) errors out in RenderOutput() as $this->gd_output is NOT a resource. Works in up to PHP v7.4.11 but (only) switching to PHP v8.0 it stops working...anyone else tested PHP v8.0?

JamesHeinrich commented 3 years ago

I have not tested it on PHP 8 (I don't currently have a PHP8 test environment). If you can find a more specific cause for the problem please post back here.

alpenbytes commented 3 years ago

I had also the issue, the only one preventing me from uograding to php8 right now. The issue here is that php changed the behavior of GD. Instead of a resource that is returned, it's an instance of \GDImage object. According to this site https://php.watch/versions/8.0/GDImage (which is linked in the official Release announcement of php8), the solution is rather simple: Besides checking if the variable "is_resource" it is also necessary to check if variable is_object AND instance of \GDImage. This is According to the site fully BC. Haven't looked into the phpthumb code as I just discovered it out yesterday. I'll give it a try tomorrow.

dleffler commented 3 years ago

I've given it a try and it seems to correct the problem...at least now I get the thumbnails under PHP v8. I don't know if I can get around to uploading a pull request.

JamesHeinrich commented 3 years ago

@dleffler if you can get around to submitting a PR that would be much appreciated.

Ibochkarev commented 3 years ago

Related https://github.com/JamesHeinrich/phpThumb/pull/162

dleffler commented 3 years ago

I've submitted 2 PR's which were already merged #162 & #166