Resizer Update

Sep 14, 2019

What's this?

Resizer is an image resizer/processor for MODX, that uses Imagine under the hood. Around the time of its release, the default phpthumb library included with MODX had serious performance issues. Imagine was the new kid on the block at the time, and Jason Grant did a LOT of work to hook it up with MODX. The (significant) performance benefits, and comparisons between different solutions, were documented here. Jason released the pThumb Extra for the benefit of the MODX community, and it was a beautiful thing.

Fast-forward 5 years, and unsurprisingly the world has moved on. As of the latest version 1.2.2, Imagine supports webp. Unfortunately it also contains breaking changes that are incompatible with Reductionist, and thus breaks Resizer in some environments.

This 1.0.2-beta release of Resizer has the modest goal of updating to version 0.7.1 of Imagine, which works and fixes some bugs. In order to be promoted to pl stability and packaged with pThumb, though, additional testing in the wild is required.

Background

There are various image processing extensions available for PHP, but depending on the server environment they may or may not be compiled and enabled. Imagine is a library providing "...the necessary functionality to bring all native low level image processing libraries in PHP to the same simple and intuitive OO API." Reductionist is an interface layer developed by Jason Grant to implement the various Imagine classes. Resizer wraps Reductionist and makes it usable in MODX. pThumb installs Resizer, along with convenience Snippets and cache management, to finally deliver image manipulation to the MODX CMS end user, with an easy-to-use interface.

How this might affect you

pThumb can be configured to use the standard phpthumb library, or Resizer. The default is phpthumb. Currently phpthumb seems to support newer file formats including webp, jp2, and jxr, enabling broad browser support. Resizer does not, because Imagine does not—at least prior to version 1.2.2, which breaks b/c. If you currently need these newer file formats, you must use phpthumb rather than Resizer.

This latest release of Resizer must be installed manually in the Extras Installer, after installing pThumb. It fixes a few bugs, but doesn't get us the latest functionality we all want. The fork has some phpunit test cases that can help in any upgrade work, going forward. Some initial research into implementing the latest Imagine versions in Reductionist, yielded disappointing results—it looks like a lot of work to refactor Reductionist. UPDATE [2019-09-17] new approach looks promising, working on update to Imagine 1.2.2. Available for testing in the _packages directory of the imagine-122 branch.

So for now, this very modest update is what I can offer. At the very least, this pThumb issue is likely handled.