danihidayatx/image-optimizer
A fork of joshembling/image-optimizer for Filament v3, v4 and v5 and Laravel 10 through 13. It adds optimize and resize methods to FileUpload and SpatieMediaLibraryFileUpload, compressing and converting images before they reach your database or S3 bucket, saving disk space.
FileUpload or SpatieMediaLibraryFileUpload components where image optimization is required before storage (e.g., S3, local filesystem).spatie/laravel-medialibrary or intervention/image if those are not already optimized for Filament.FileUpload components with minimal overrides, reducing risk of breaking changes.booted events or Filament’s form lifecycle (e.g., beforeSave or afterUpload).FileUpload variant).joshembling/image-optimizer) is unmaintained; fork may introduce subtle bugs or lack long-term support.spatie/laravel-medialibrary hooks)?FileUpload and SpatieMediaLibraryFileUpload.File uploads (would need custom middleware).composer require danihidayatx/image-optimizer
Publish config if needed (check for customization options).imagick or gd) in config/filament-image-optimizer.php.max_width, max_height).FileUpload with OptimizedFileUpload (or use traits/mixins).SpatieMediaLibraryFileUpload, extend the component to include optimization logic.FileUpload if optimization introduces critical issues.storage/logs/laravel.log for errors; validate optimizer CLI tools (convert, identify).FileUpload if needed.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Missing ImageMagick/GD | Uploads fail silently | Fallback to GD or notify users |
| Corrupt/Unsupported Image | Optimization fails | Reject or store original |
| Storage Permission Issues | Optimized files not saved | Verify storage permissions |
| High CPU Load | Slow uploads/timeouts | Queue optimization or reduce quality |
| Filament Version Incompatibility | Breaks UI | Pin to specific Filament version |
SpatieMediaLibrary integration.How can I help you explore Laravel packages today?