JamesHeinrich / phpThumb

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

PHP 7.2 Compatibility #139

Closed dbarrow2019 closed 5 years ago

dbarrow2019 commented 5 years ago

My hosting provider recently upgraded to PHP 7.2 and all sorts of things quit working. I am trying to get your demo working here, but most of it doesn't work anymore. Here is the link to the demo on my site:

http://www.davidbarrow.com/phpThumb-master/demo/phpThumb.demo.demo.php

Any help would be appreciated.

Ibochkarev commented 5 years ago

@dbarrow2019 Perhaps a solution here https://github.com/modxcms/revolution/pull/14494/files

JamesHeinrich commented 5 years ago

@dbarrow2019: Opening any of the individual images on the demo page shows the error message: ERROR: $PHPTHUMB_CONFIG[high_security_password] is not complex enough You'll need to create a more complex password in phpThumb.config.php around line 45 If you still have problems after that, and you're looking at a specific image URL (not just the demo page as a whole) please reopen this ticket.

@Ibochkarev: that's unlikely to be the cause of the problem, and I'm not sure why someone coded that "fix" like that. The only place that the IMG_WEBP constant is used is in phpthumb.class.php around lines 468-470 and that's wrapped in an if (defined('IMG_WEBP'))

dbarrow2019 commented 5 years ago

I disabled the high_security_password parameter to test and a few images showed up, but most of the examples still don't show up. It looks like PHP 7.2 no longer passes variables with the ampersand, Like:

src=images%2Fanimaple.gif&w=25&f=gif&

Is there some workaround or new way to do this in PHP 7.2?

JamesHeinrich commented 5 years ago

Nothing has changed with regards to parameter passing, and looking at the demo page on your server it seems to be working fine. Well, most images do load, albeit quite slowly (multiple page refreshes show more and more successfully-generated thumbnails as they're generated and cached). It seems your server is somewhat slow for generating dozens of thumbnails at once, but most of them do appear to be working. Some of the examples show the generic purple "there's-an-error" image (you need to enable debug mode to see the exact nature of the error, this is on purpose to avoid exposing sensitive information on a production server).