Phpthumbof with MODX 3.0.x

Summary

Hey everyone. After update to MODX 3.0.x, the popular addon phpthumbof became broken.

After some research I found that required class modPhpThumb was moved from core/model/phpthumb/… to core/src/Revolution/modPhpThumb.php. In phpthumbof snippet this class basicly loads with loadClass, but I can’t do it for new version:

  • If I rename it to modphpthumb.class.php or require class directly, I have an exception Uncaught Error: Class ‘modPhpThumb’ not found in …/core/components/phpthumbof/model/phpthumbof/phpthumbof.class.php:193.
  • If I connect class directly not from snippet but from phpthumbof.class.php, I have another error message: Cannot declare class MODX\Revolution\modPhpThumb, because the name is already in use in …/core/src/Revolution/modPhpThumb.php on line 23.

Phpthumbof is a very old addon and I think that there will be no official fix for this issue. Do anyone have any experience about usage phpthumbof with MODX 3 or maybe there is any another plugin with same functionality working with MODX 3?

Step to reproduce

Try to use phpthumbof with MODX 3.0.x and read error logs.

Observed behavior

See summary

Expected behavior

Correct work of phpthumbof plugin

Environment

MODX 3.0.2, php 7.4

Hey @paswd-ru

Try pthumb - it’s a drop-in replacement for phpthumbof [so you shouldn’t need to update your code] and it works on MODX 3.x

Oh, it works, thanks. Strangely that I won’t decide to use it early - I thought that I’ve already tried it.

1 Like

Glad you’ve got it working :+1:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.