infinityweb/glide-optimizer

An optimizer manipulator for Glide that uses ps/image-optimizer package.

1.0.0 2020-10-22 08:42 UTC

This package is not auto-updated.

Last update: 2021-03-03 14:01:54 UTC


README

Software License Packagist Version

This manipulator uses ps/image-optimizer package to minify resources.

Inspired by https://github.com/approached/laravel-image-optimizer

Installation

  • Recommend convert packages:
sudo apt-get install pngquant gifsicle jpegoptim
  • Require this package with composer:
composer require infinityweb/glide-optimizer

Usage

$server = League\Glide\ServerFactory::create([
    'source' => 'path/to/source/folder',
    'cache' => 'path/to/cache/folder',
]);

$manipulators = $server->getApi()->getManipulators();
$manipulators[] = new Infinityweb\Glide\Optimizer\OptimizerManipulator();

$server->getApi()->setManipulators($manipulators);

For better optimization use imagick driver.