spatie/statamic-responsive-images
Statamic addon by Spatie that adds a responsive images fieldtype with art direction and breakpoint support. Automatically generates responsive image variants on upload and lets you render them easily in Antlers via the responsive tag.
composer require spatie/statamic-responsive-images) with zero Statamic core modifications. No database migrations or schema changes required.{{ glide }} with {{ responsive }} tags, enabling gradual adoption. Existing Glide logic can coexist via glide: prefixed parameters.responsive fields, enabling headless use cases without templating changes.| Risk Area | Severity | Mitigation |
|---|---|---|
| Glide Cache Dependency | Medium | Requires statamic.assets.image_manipulation.cache = false for lazy generation. Risk of slow first loads if misconfigured. |
| Queue Job Failures | Low | Jobs are retried by default (Laravel Horizon/Queues). Monitor failed_jobs table. |
| Breakpoint Mismatches | Medium | Tailwind breakpoints default; custom breakpoints may conflict with frontend CSS. Validate via browser dev tools. |
| Statamic Version Drift | High | Tested up to Statamic 6.6+ (changelog). Pin version in composer.json if using older Statamic. |
| Performance Overhead | Low | Lazy generation reduces storage/CPU load. Monitor spatie/responsive-images:generate queue. |
Statamic Version Strategy:
"spatie/statamic-responsive-images": "6.x" for Statamic 6.x.Image Processing Workflow:
statamic.assets.image_manipulation.cache be disabled (recommended) or enabled for pre-generation?php please responsive:regenerate) during deployments.Breakpoint Alignment:
config/responsive-images.php.'breakpoints' => [
'sm' => '640px',
'md' => '768px',
'lg' => '1024px',
'xl' => '1280px',
],
Format/Quality Tradeoffs:
{{ responsive:image_field avif="false" webp="true" quality:webp="80" }}
Asset Container Exclusions:
logos, icons) where responsive variants are unnecessary? Exclude them via config:
'excluded_containers' => ['logos', 'favicons'],
Queue Infrastructure:
default queue is monitored for job failures.'queue' => 'images', // Custom queue name
GraphQL Headless Use:
responsive field arguments match frontend needs (e.g., ratio, glide_width).Custom HTML Needs:
<img> output? Publish views:
php artisan vendor:publish --provider="Spatie\ResponsiveImages\ServiceProvider"
Statamic Ecosystem:
assets fieldtype).{{ responsive }}) replace or augment {{ glide }}.Frontend Compatibility:
srcset and sizes attributes dynamically via JavaScript (for sizes).lg:ratio="16/9").Backend Services:
default) for async image generation.image_manipulation.cache setting controls pre-generation.| Phase | Action | Risk | Validation |
|---|---|---|---|
| 1. Pilot Testing | Install in a staging environment. Test with 2–3 critical entry types. | False positives in responsive logic. | Visual diffs in browser dev tools. |
| 2. Fieldtype Rollout | Replace existing image fieldtypes with responsive in blueprints. |
Editor confusion on new UI. | User acceptance testing (UAT). |
| 3. Templating Update | Replace {{ glide }} with {{ responsive }} in templates. |
Broken layouts if srcset misconfigured. |
Cross-browser testing (Chrome/Firefox/Safari). |
| 4. Queue Monitoring | Set up alerts for spatie/responsive-images:generate job failures. |
Silent failures in production. | Laravel Horizon or queue monitoring. |
| 5. Performance Tuning | Disable statamic.assets.image_manipulation.cache if not needed. |
Slow first loads. | Load testing with real user traffic. |
spatie/laravel-medialibrary). Audit for overlaps.responsive-images.php).responsive fieldtype.srcset generation.quality settings based on real-world performance.responsive-images.php) reducesHow can I help you explore Laravel packages today?