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 - not saving to cache #72

Open
RuthEd opened this issue Jun 5, 2022 · 7 comments
Open

php 8 - not saving to cache #72

RuthEd opened this issue Jun 5, 2022 · 7 comments

Comments

@RuthEd
Copy link

RuthEd commented Jun 5, 2022

After upgrading to php 8 (modx 2.84 or 3.0 or 3.01), I'm getting the following error - the images are all showing up on the page, but the cache is empty. All was working fine on php7.4. Any ideas?

[2022-06-04 16:33:17] (ERROR @ /homepages/[account-num]/htdocs/core/components/phpthumbof/model/phpthumbof.class.php : 156) [pThumb] Resource: 1 || Image: assets/images/header-new-17.jpg
Could not cache thumbnail to file at: /homepages/[account-num]/htdocs/assets/image-cache/header-new-17.c86d3627.jpg
Resizer debug output:
[0] => Resizer v1.0.1
[1] => Using GD
[2] => Input file: assets/images/header-new-17.jpg
[3] => Input options:
'f' => 'jpeg'
[4] => *** Error *** Unable to open image assets/images/header-new-17.jpg

@RuthEd RuthEd changed the title php 8 php 8 - not saving to cache Jun 8, 2022
@labr1005
Copy link

I'm currently facing the same problem. Did you find a solution for this?

@RuthEd
Copy link
Author

RuthEd commented Oct 18, 2022

PHP 8 was also causing me problems with the Collections extra so I'm afraid I went back to PHP 7.4 for the moment. Although I manage pretty well with simple PHP snippets, my knowledge is not good enough to find the problems in other code so I expect I'll try again in a few months hoping someone cleverer than me has solved the problem meanwhile.

@pixelstuff
Copy link

pixelstuff commented Feb 12, 2023

I just noticed this problem too. Thumbnails are not being generated and cached after switching to PHP 8.0.

Is the issue mainly from Resizer and PHP 8.0?

@valokammi
Copy link

This is Resizer issue on PHP 8! On Modx 3.0.3, PHP 8.1 and resizer-2.0.1-dev (Laragon windows) no errors in console. But ALL output paths are directly to originals, not cached images.

On PHP 7.4 paths are correct.

@jenswittmann
Copy link

Hello,
i've got the same error today and test it on to different sites. Here are the results.

Host: IONOS Germany
MODX 3.0.2
pThumb 2.3.3-pl
resizer 1.0.2-beta
PHP: 8.1
Imagick: no
GD: yes

[[!pthumb? &input=`upload/PNGRIFF838.jpg` &options=`w=519`]] > failed

Host: All-Inkl
MODX 3.0.3
pThumb 2.3.3-pl
resizer 1.0.2-beta
PHP: 8.1
Imagick: yes
GD: yes

[[!pthumb? &input=`upload/PNGRIFF838.jpg` &options=`w=519`]] > success

On IONOS is Imagick not avaible, so it use GD. If i changed to GD on the working Host it also failed.

Maybe it is a problem width GD?

@jenswittmann
Copy link

After looking deeper into that i found a solution for IONOS and GD Lib.

  1. I activate Resizer in the phpthumbof system_settings (because its modern and fast).
  2. Comment out the following in file core/components/resizer/model/vendor/imagine/imagine/lib/Imagine/Gd/Imagine.php. Because a change in PHP8 (On success, this function returns a GDImage instance now; previously, a resource was returned, see https://www.php.net/manual/en/function.imagecreatefromstring.php). image
  3. Add the following in file core/components/resizer/model/vendor/sepiariver/reductionist/src/Reductionist/Reductionist.php, because on IONOS memory_limit is set on -1.
    image

Now it seems to work with pThumb, Resizer and GD ✅

The pThumb Extra uses Reductionist and Imagine under the hood. Reductionist should be work fine on PHP8, because there is only a "problem" for the memory_limit calculation when set on -1. For Imagine is a newer Version with PHP8 support ready and should be updated?

I will have a deeper look into it later ⌛

@modxcommunity
Copy link

This issue has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/pthumb-resizer-and-modx-3/6366/7

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

No branches or pull requests

6 participants