Skip to content

Simple CockpitCMS addon that integrates with Spatie image optimization library.

License

Notifications You must be signed in to change notification settings

zeraton-de/CockpitCMS-ImageOptimizer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Optimizer add-on for Cockpit CMS

This add-on enhances Cockpit CMS by providing automatic image optimization when saving an asset image. The image optimization is performed using the Spatie library - https://github.com/spatie/image-optimizer

Installation

Download and unpack add-on to <cockpit-folder>/addons/ImageOptimizer folder. By default the Spatie library will detect any optimization binaries on your system and use them, more details about that on https://github.com/spatie/image-optimizer#optimization-tools.

Configuration

No additional configuration is required.

Usage

Add-on is fully transparent to the user, performing the optimization when uploading an asset. In the below example we can see the upload of two images (png and jpg) without the addon and the difference after enabling it:

Example screencast

If you have already a bunch of asset images that are not optimized you can run the cli command, e.g.:

[email protected]:/var/www/html $ ./cp images-optimize
Optimizing 3 assets! Please wait...

/2019/10/10/5d9f01a9f1767desert-sunrise-600-300.jpg optimized! From 78.39 KB to 25.61 KB
/2019/10/10/5d9f01ad9a054dandelion-600-300.jpg optimized! From 80.72 KB to 28 KB
/2019/10/10/5d9f01b12b23bpexels-photo-laptop.jpg optimized! From 64.21 KB to 59.1 KB

Done! 3 assets updated in 3.16s.

Copyright and license

Copyright 2019 pauloamgomes under the MIT license.

About

Simple CockpitCMS addon that integrates with Spatie image optimization library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%