folklore/laravel-image
A Laravel image package that simplifies common image workflows with a clean API for resizing, cropping, and generating thumbnails while integrating with Laravel’s filesystem and configuration. Useful for handling uploaded images and model attachments in apps.
laravel-mediatheque 2 has an installable alpha before planning adoption; this release requires ^2.0@alpha and resolves media ids through that package’s media resolver.config/image.php. Only override the keys you need: presets, url.host, url.prefix, signing.*, strict, limits, delivery, upscale.php artisan image:doctor before writing application code. It checks the renderer driver and formats, FFI/libvips, disk read/write/delete, lock store, signing key, route behavior, session cookies, and URL host. Use --write only against a safe derivatives disk.Image::for($path)->preset('thumb')->url(). For private sources, use signed(expires: ...); unsigned URLs are not an option.Route::image($prefix) or Image::routes() for canonical v2 paths, or serve versioned URLs through a CDN and let DiskStore redirect to a public disk URL.PendingImage builder as the single URL/spec composition point: preset(), width(), height(), size(), fit(), ratio(), format(), quality(), signed(), host(), then url(), variant(), variants(), or render(). Keep this in controllers, API resources, and Blade view models rather than constructing URLs by hand.variants() to get the preset’s responsive widths × formats with exact dimensions from source metadata. Feed those into srcset/picture, and use ImageVariantResource ({preset, url, width, height, mime}) for JSON APIs so clients do not need image dimensions.Cache-Control: public, max-age=31536000, immutable; changing widths, formats, or rendering behavior without bumping the preset version leaves stale CDN and browser caches in place.Image::resolver(). Use the disk resolver with an optional root for any Laravel disk. Use Image::useHost() when URLs must vary per request, tenant, or CDN hostname.limits at URL-build time so invalid specs fail in the application, not during rendering.503 with Retry-After. Use Redis or another atomic shared store for production route rendering.Image::fake(), which works through the builder and keeps derivatives in memory via InMemoryDerivativeStore. Use it for URL/spec and controller tests, but keep at least one integration test against the real resolver, renderer, store, and route.ImageSpec, UrlCodec, Signer, SourceResolver, ImageSource, Renderer, Operation, DerivativeStore, ImageVariant) and use the provided contract test traits. This is the intended path for custom storage, signing, or rendering engines.InterventionRenderer to use the auto driver order: libvips, then Imagick, then GD. Pin image.renderer.driver where output must be reproducible across environments, especially for AVIF, HEIC, color profiles, and EXIF handling.DiskStore for derivatives on any Laravel disk under image.derivatives.path; configure public-disk redirects deliberately. For S3-compatible disks, versioning derives from mtime or ETag and is cached for version_ttl, so source changes can take up to that TTL to appear as new versions.2.0.0-alpha.1: APIs, config keys, and contracts can change before stable. Do not ship it as the only image path in a production application without a rollback plan.laravel-mediatheque 2 alpha may not be available at the same time as this release. Verify dependency resolution before estimating migration work.strict mode changes behavior: free-form specs get signed URLs, presets are served at current versions and widths, and limits are enforced at URL construction. Audit generated URLs and tests under both strict and non-strict settings.private for private sources and clips max-age to the URL’s remaining lifetime, but your own proxies and CDN rules must respect it.APP_KEY and APP_PREVIOUS_KEYS by default. Plan key rotation with previous keys configured, or old URLs will fail signature checks. Rebuild config caches after key changes.image:doctor’s route check will flag it. Keep the route on a minimal middleware stack, or serve through the CDN and public disk redirects instead.private. Changing a source file behind the same version will not invalidate browser or CDN caches.DiskStore redirects to the disk URL only when the disk is public. On private disks it must stream, which changes CDN behavior and offload characteristics.503/Retry-After under load and size PHP timeouts, memory, and lock wait limits accordingly.image:doctor, not assumptions.intervention/image must be at least 4.3.4. The renderer applies the spec’s or source’s transform, writes JPEG, PNG, GIF, WebP, and AVIF with per-format image.quality, and raises image.memory_limit during rendering. Large source images can still exhaust memory; set limits and test representative files.image:doctor --write writes, reads, and deletes a file on the derivatives disk. Do not point it at an unrelated production disk or a path with meaningful contents.Image::fake() is not an end-to-end test. It does not exercise the real route, signing expiry, CDN headers, lock contention, or disk driver behavior. Keep a real integration test for the disk resolver, renderer, store, and route.config:cache after changing presets, hosts, prefixes, signing settings, limits, or delivery mode.version_ttl and the disk’s ETag/mtime behavior before debugging the renderer.How can I help you explore Laravel packages today?