spatie/laravel-glide
Laravel wrapper around League Glide for easy image manipulation and caching. Create, resize, crop, apply filters, and save images via a fluent API (e.g., width, greyscale). Supports GD or Imagick, with configurable settings and a convenient facade.
GlideImage), aligning well with MVC separation of concerns. It decouples image processing from business logic, making it ideal for media-heavy applications (e.g., e-commerce, CMS, or SaaS platforms).GlideImage::cache()), and storage systems (S3, local, etc.), reducing boilerplate for common use cases like thumbnails or format conversion.GlideImage::create()) mirrors Laravel’s Eloquent conventions, easing adoption.glide:queue middleware), synchronous operations could degrade response times under load.@glide), and storage APIs. Works out-of-the-box with Laravel 8+.@glide) simplify image URLs in templates, but custom directives may be needed for non-Blade setups (e.g., Inertia.js, Livewire).GlideImage) enables unit testing; integration tests should validate storage and queue interactions.glide:queue middleware to offload processing and monitor queue backlogs.GlideImage calls in templates and APIs.Image libraries (e.g., Intervention) to Glide for consistency.composer.json constraints). PHP 8.1+ required.ShareErrorsFromSession) but may conflict with custom middleware altering request lifecycle.Cache-Control) must align with CDN/CDN-proxy settings to avoid double-caching.composer require spatie/laravel-glide).php artisan vendor:publish --tag=glide-config).@glide) to templates.GlideImage::url() in APIs.disk, response_format) for cost/performance tradeoffs.composer.json to avoid unexpected upgrades during Laravel updates.GlideImage::debug() to inspect processing errors. Log queue failures for async tasks.w, h, filt).memory_limit for large images (e.g., 512M+).driver (e.g., imagick for better performance than gd).response_format to generate smaller files (e.g., webp).cache to true for static images to reduce reprocessing.| Failure Scenario | Mitigation |
|---|---|
| Queue backlog | Monitor failed_jobs table; scale workers or optimize image processing. |
| Storage permission errors | Ensure storage adapter has write access; use storage:link for local disks. |
| Memory exhaustion | Increase memory_limit; process smaller batches or use imagick. |
| Corrupted input images | Validate file types (e.g., mime_type) before processing. |
| CDN cache invalidation | Implement cache busting (e.g., query strings) or purge CDN on config changes. |
GlideImage::create()->resize(800, null)).GD/Imagick extensions).GlideImage::extend('watermark', ...)).@glide directives in templates.How can I help you explore Laravel packages today?