- How do I install spatie/image in a Laravel app?
- Install it with Composer using composer require spatie/image. You need PHP 8.1 or newer and at least one supported image extension, such as GD, Imagick, or Vips; GD is the default fallback. No external service is required, and in Laravel you can use Spatie\Image\Image directly in controllers, jobs, observers, or alongside the Storage facade.
- Which image driver should I use with spatie/image: GD, Imagick, or Vips?
- Spatie Image abstracts GD, Imagick, and Vips behind one API, so the same chain works across drivers. GD is the lightweight default fallback, Imagick is often preferred for advanced features and production workloads, and Vips can be faster for heavy processing. Format support and performance depend on the installed PHP extension and its delegates, so test on your host.
- Does spatie/image work with Laravel 10, 11, and 12?
- Spatie Image is a framework-agnostic PHP package, so it can be used in Laravel 10, 11, and 12 as long as the application meets its PHP 8.1+ and image-extension requirements. It does not depend on a specific Laravel major version for its core manipulation API. Check the package Composer constraints and release notes for exact compatibility with your Laravel and PHP versions.
- How do I resize, crop, and save images with spatie/image's fluent API?
- Load an image with Image::load($path), chain operations such as width(100)->height(100), fit(200, 200), crop(), greyscale(), brightness(), quality(), or sharpen(), then call save($newPath). For example, Image::load($path)->width(100)->height(100)->save($newPath) fits the image into a 100x100 box without changing aspect ratio. The fluent API keeps pipelines readable and composable inside Laravel services, observers, or jobs.
- Can spatie/image resize images in the background using Laravel queues?
- Spatie Image has no built-in queue support, so async processing is handled by Laravel queue system. Put the Image::load()->resize()->save() chain inside a job and dispatch it from your controller or observer. For large batches, use multiple queue workers or chunked jobs because the package itself does not provide native parallelism.
- How do I use spatie/image with Laravel Storage or S3?
- The package focuses on local filesystem paths, so local disks work well with Storage::disk('public')->path($file) or storage_path(). For S3 or other cloud disks, download or stream the object to a temporary local file, process it with Spatie Image, then upload the result back through the Storage facade. There is no native CDN or cloud-storage optimization, so your app must handle temp files and cleanup.
- Does spatie/image support WebP and AVIF images?
- WebP and AVIF support is driver-dependent, not guaranteed by the package itself; it depends on the underlying GD, Imagick, or Vips build and its delegates. For AVIF, GD must be compiled with libavif support and Imagick needs a libheif delegate, so verify with gd_info() or Imagick::queryFormats('AVIF') on each environment. Since 3.9.7, palette or indexed source images are converted to truecolor before GD AVIF encoding to avoid corrupt output.
- How should I test image manipulation code that uses spatie/image?
- Use small fixture images and write processed output to temporary files, then assert dimensions, MIME type, or file existence rather than comparing raw binary data. In Laravel tests, you can fake Storage for uploads and still process a local fixture path with Spatie Image. Because results can vary by driver, run the relevant checks against the same GD, Imagick, or Vips configuration used in CI or production.
- What production concerns should I watch for when using spatie/image?
- Check driver availability and format support on the production host, especially for WebP and AVIF, because support is determined by the PHP extension build. Watch memory and CPU use for large images or batch jobs, and offload heavy work to Laravel queue workers. The package is lightweight and has no external services, but cloud storage flows need temporary files and cleanup, and the package does not provide native parallelism.
- How does spatie/image compare to Intervention Image, and is it still maintained?
- Spatie Image is known for its expressive fluent API and driver abstraction across GD, Imagick, and Vips, while Intervention Image is another popular Laravel-friendly option with its own driver model. Spatie Image is an actively maintained MIT-licensed Spatie package with automated tests, but you should still review release notes for driver-specific fixes such as the AVIF palette handling in 3.9.7. Choose based on the API style, driver requirements, and format support your application needs.