scratcher28/glide-optimizer

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

0.1.3 2020-03-12 12:33 UTC

This package is not auto-updated.

Last update: 2021-02-25 17:28:16 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);