Stix Posted 23 hours ago Posted 23 hours ago Hi everyone, I'd like to share a new ImageSizerEngine module I've been working on: Intervention Image Sizer, which uses Intervention Image v4 as the underlying image manipulation library instead of GD/Imagick being called directly. It's a drop-in replacement: once installed, $page->image->size(), crops, WebP variations etc. all keep working exactly as before, no template changes required. Credit where it's due: I got the idea after reading this post about Intervention Image Engine. That module takes its own approach (own responsive-image handling on top of Intervention Image). For this one, I wanted a straightforward ImageSizerEngine that plugs directly into ProcessWire's built-in image sizing. So it extends the core ImageSizerEngine base class and implements its abstract methods (processResize, processRotate, processFlip, etc.) directly against Intervention Image v4, rather than building on top of that other module. Why another ImageSizerEngine? Intervention Image v4 gives you one consistent API on top of three different backends: GD, Imagick, and libvips. This module lets you pick the driver per installation from the module settings, so you can: - Stick with GD if that's all you have (default, always available, zero extra setup). - Switch to Imagick if it's installed and you need it for something specific. - Switch to libvips for significantly lower memory usage and faster processing on large images_ useful if you're dealing with high-res uploads or a busy image-heavy site. - Use Animated GIF support everywhere Features - Selectable driver: GD, Imagick, or libvips (auto-detected, the dropdown only shows drivers that are actually available on your server). - Extended format support with Imagick/libvips: AVIF, TIFF, HEIC, HEIF, in addition to the usual JPG, PNG, GIF, WEBP. - Full support for the standard ImageSizerEngine options: auto-orientation (EXIF), rotate, flip, cropping (including focus-zoom cropping), sharpening. - Optional WebP sibling generation (webpAdd / webpOnly). - Greyscale and sepia conversion. - Optional temporary memory_limit bump during resize operations: can be restricted to animated images only. - Optional debug logging of each resize step to Setup > Logs > intervention-image. - Module config screen shows GD/Imagick/libvips availability, FFI status, and current PHP memory_limit at a glance. Requirements - PHP >= 8.3 - GD extension (default/fallback driver) - Optional: imagick PHP extension for the Imagick driver - Optional: ffi extension (with ffi.enable = true) plus libvips installed, for the libvips driver Installation Easiest way: grab the release zip from the Releases page: it ships with vendor/ bundled in, no composer step needed. Extract into site/modules/ and install from Modules > Refresh. To build from source instead: clone into site/modules/ImageSizerEngineIntervention and run composer install before installing the module. Download / GitHub: GitHub Repo Feedback welcome Still fairly fresh, so I'd appreciate any testing/feedback, especially around the libvips driver, since FFI setup varies a lot between hosting environments. Bug reports and PRs welcome here or on GitHub. 3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now