Download the PHP package joshembling/image-optimizer without Composer
On this page you can find all versions of the php package joshembling/image-optimizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joshembling/image-optimizer
More information about joshembling/image-optimizer
Files in joshembling/image-optimizer
Package image-optimizer
Short Description Optimize your Filament images before they reach your database.
License MIT
Homepage https://github.com/joshembling/image-optimizer
Informations about the package image-optimizer
[!CAUTION]
There are no plans to extend this plugin's lifetime beyond Filament v3. Please do not plan to use this in production if you are thinking of upgrading to Filament v4 when it is released in 2025.
Optimize your Filament images before they reach your database.
When you currently upload an image using the native Filament component FileUpload
, the original file is saved without any compression or conversion.
Additionally, if you upload an image and use conversions with SpatieMediaLibraryFileUpload
, the original file is saved with its corresponding versions provided on your model.
What if you'd rather convert and reduce the image(s) before reaching your database/S3 bucket? Especially in the case where you know you'll never need to save the original image sizes the user has uploaded.
🤳 This is where Filament Image Optimizer comes in.
You use the same components as you have been doing and have access to two additional methods for maximum optimization, saving you a lot of disk space in the process. 🎉
Contents
- Contents
- Installation
- Usage
- Optimizing Images
- Resizing Images
- Combining Methods
- Multiple Images
- Examples
- Debugging
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- Licence
Installation
You can install the package via composer, which currently works with the latest Filament version (^3.2) and Laravel 10 & 11:
If you are using Filament 3.0 or 3.1 install with:
Usage
Filament version
You must be using Filament v3.x to have access to this plugin.
For specific versions that match your PHP, Laravel, Filament and Image Optimizer installations please see the table below:
PHP | Laravel version | Filament version | Image Optimizer version |
---|---|---|---|
^8.1 | ^10.0 | ^3.0 | 1.2 |
^8.1 | ^10.0 | ^3.1 | 1.2 |
^8.1 | ^10.0 | ^3.2 | ~1.3 |
^8.2 | ^10.0, ^11.0 | ^3.2 | ^1.4 |
Server
GD Library must be installed on your server to compress images.
Optimizing images
Before uploading your image, you may choose to optimize it by converting to your chosen format. The file saved to your disk will be the converted version only.
E.g. I want to convert my image to 'webp':
`
Resizing images
You may also want to resize an image by passing in a percentage you would like to reduce the image by. This will also maintain aspect ratio.
E.g. I'd like to reduce my image (1280px x 720px) by 50%:
`
Combining methods
You can combine these two methods for maximum optimization.
`
Multiple images
You can also do this with multiple images - all images will be converted to the same format and reduced with the same percentage passed in. Just chain on multiple()
to your upload:
`
Examples
Debugging
-
If you see a 'not found' exception, including "Method
optimize
" or "Methodresize
", ensure you runcomposer update
so that your lock file is in sync with yourcomposer.json
. - You might see a 'Waiting for size' message and an infinite loading state on the component and the likely cause of this is a CORS issue. This can be quickly be resolved by ensuring you are serving and upload images from the same domain. Check your Javascript console for more information.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Josh Embling
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of image-optimizer with dependencies
filament/forms Version ^3.0
illuminate/contracts Version ^10.0|^11.0
intervention/image Version ^2.7
spatie/laravel-package-tools Version ^1.15.0