justbetter / statamic-image-optimize
Image optimization after upload
Installs: 2 712
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 4
Forks: 6
Open Issues: 0
Type:package
Requires
- php: ^8.1|^8.2|^8.3
- ext-fileinfo: *
- laravel/framework: ^10.0 || ^11.0
- league/glide: ^2.2
- statamic/cms: ^5.0
Requires (Dev)
- larastan/larastan: ^2.5
- laravel/pint: ^1.7
- orchestra/testbench: ^8.0|^9.0
- pestphp/pest: ^2.0
- phpstan/phpstan-mockery: ^1.1
- phpunit/phpunit: ^10.1
- dev-main
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.0
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-feature/tests
- dev-feature/banner
- dev-feature/laravel-10-support
- dev-statamic-4-compatibility
- dev-cli-verbose-option
- dev-eloquent-driver
- dev-resize-on-reupload-event
This package is auto-updated.
Last update: 2024-11-05 09:37:07 UTC
README
Image Optimize
Image optimization after upload
How to Install
You can search for this addon in the Tools > Addons
section of the Statamic control panel and click install, or run the following command from your project root:
composer require justbetter/statamic-image-optimize
Requirements
The addon makes use of batches to optimize the images.
Because of this you need an active Database connection that contains the job_batches
table.
You can generate this table by running the following commands:
php artisan queue:batches-table
php artisan migrate
Config
Publish
php artisan vendor:publish --provider="JustBetter\ImageOptimize\ServiceProvider"
Settings
It's possible to change to default resize width and height by overriding the config file and changing the parameters within.
Commands
php artisan justbetter:optimize:images
By running this command you can recursively optimize all the images in the assets folder.
Options
Add the --forceAll
option to force the command to optimize all images.
Otherwise the command will only optimize images that have not been optimized yet.
You can also use the verbose option by adding -v
to your command,
this will show a progress bar containing the amount of jobs left in the batch.
Features
-
After an image is uploaded an event will trigger to optimize the image. The event optimizes the images and resizes it to a specified size, this is being controlled by the config file.
-
By using the resize images command you can recursively optimize all the images in the assets folder.
-
Added an action in the CP Asset overview that allows you to select assets and trigger the optimize job manually.
-
Added an CP page to manually optimize all images, triggering this will show a progress bar containing the remaining images.