justbetter/statamic-image-optimize

Image optimization after upload
22,494 13
Install
composer require justbetter/statamic-image-optimize
Latest Version:5.2.0
PHP:^8.4|^8.5
License:MIT
Last Updated:Jun 1, 2026
Links: GitHub  ·  Packagist
Maintainer: justbetter

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 Laravel Batches to optimize 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

If your queue connection is not sync, make sure a queue worker is running.

Config

Publish

php artisan vendor:publish --provider="JustBetter\ImageOptimize\ServiceProvider"

Settings

You can change the default resize width/height and queue settings in config/image-optimize.php (or via env vars like IMAGE_OPTIMIZE_WIDTH, IMAGE_OPTIMIZE_HEIGHT, IMAGE_OPTIMIZE_QUEUE_CONNECTION, IMAGE_OPTIMIZE_QUEUE_NAME).

Commands

php artisan justbetter:optimize:images

By running this command you can optimize images in the Statamic asset library.

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 optimize images command you can optimize images in the asset library.
  • Added an action in the CP Asset overview that allows you to select assets and trigger the optimize job manually.
  • Added a CP page to optimize remaining images or force-optimize all images, showing batch progress while it runs.

Related Packages

mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

21,010,090 1,982
kyslik/column-sortable

Package for handling column sorting in Laravel 6.x

6,282,182 647
mews/captcha

Laravel 5/6/7/8/9/10/11/12 Captcha Package

6,095,827 2,586
ajthinking/archetype

Programmatically edit PHP and Laravel files.

4,372,487 272