- How do I install gumlet/php-image-resize in a Laravel application?
- Install it with Composer using composer require gumlet/php-image-resize:^3.0. There is no Laravel service provider, facade, or config file to publish, so Composer autoloading is enough. For cleaner architecture, bind the class behind your own ImageResizer contract in the Laravel service container.
- Does gumlet/php-image-resize support Laravel 10 and Laravel 11?
- Yes. It is a framework-agnostic PHP library with no Illuminate version constraints, so it installs cleanly on Laravel 9, 10, and 11 when the runtime meets its PHP requirements. The real compatibility check is PHP 8.1 or newer with the gd and fileinfo extensions enabled. Confirm those extensions in CI, PHP-FPM, and queue worker containers.
- What PHP version and extensions does gumlet/php-image-resize require?
- Version 3.x requires PHP 8.1 or newer with ext-gd and ext-fileinfo. For PHP 7.2 through 8.0, use the 2.0.x line; PHP 8.0 legacy installs may stay on 2.1.x if already using it. Pin the major version explicitly so an upgrade does not surprise production.
- How do I resize an image uploaded through Laravel or stored in S3?
- The library operates on local file paths, data URLs, or binary strings passed to ImageResize::createFromString, not directly on Flysystem streams. Write the upload or downloaded S3 object to a temporary path, resize, scale, or crop it, then move or stream the result back to your storage disk. A thin adapter around Laravel's Storage facade keeps this clean.
- Can gumlet/php-image-resize convert images to WebP or AVIF?
- No. Its scope is resizing, scaling, and cropping with GD, not modern format conversion. If you need WebP or AVIF output, add that step with GD, Imagick, or a CDN image service. Treat format conversion as a separate adapter or job responsibility rather than expecting it from this library.
- What is the difference between resize, scale, and crop in this library?
- In general, resize targets explicit width and height, scale preserves the aspect ratio while fitting dimensions, and crop trims the image according to a chosen crop mode. The resize method accepts an allow_enlarge flag, which defaults to false so smaller images are not upscaled unintentionally. Use the crop modes when you need exact output dimensions without distortion.
- Is gumlet/php-image-resize safe to use for user uploads in production?
- It can be safe, but GD is memory-hungry and synchronous processing of unbounded source images is a denial-of-service risk. Enforce maximum upload size and pixel dimensions, validate MIME types with fileinfo, and run resizing inside a queued job with memory and time limits. Avoid resizing large user uploads directly in the web request path.
- How does gumlet/php-image-resize compare with Intervention Image?
- They overlap heavily, but this library is a lighter, typed, plain PHP utility with no Laravel coupling. Intervention Image offers broader image-processing features and is common in Laravel projects, so check whether you already depend on it before adding a second resizer. If you migrate, extract your own Resizer contract and compare output dimensions, quality, and color handling with fixtures.
- How do I upgrade from 2.x to 3.x of gumlet/php-image-resize?
- Treat 3.x as a scheduled major upgrade, not a drop-in patch. It raises the PHP floor to 8.1, adds typed methods and static return types, requires a non-empty string path in the constructor, and restricts createFromString to strings. Behavior is largely the same, but custom subclasses must match the new signatures and older runtimes must stay on 2.x.
- Does gumlet/php-image-resize support queues or async image processing in Laravel?
- No. It is a synchronous plain PHP library with no queue or Laravel integration, so asynchronous behavior is your responsibility. Create a Laravel job that performs the resize inside a worker, and make sure that worker image includes gd and fileinfo. Dispatching the job keeps slow GD work out of user-facing requests.