The jpg-compress addon for PHULP. It's a wrapper for intervention/image.
$ composer require saedigital/phulp-jpg-compress
<?php
use SaeDigital\JpgCompress\JpgCompress;
$phulp->task('jpg-compress', function ($phulp) {
$phulp
->src(['src/'], '/jpg$/')
->pipe(new JpgCompress)
->pipe($phulp->dest('dist/'));
});
Image processing extensions.
- GD
- Imagick (default)
Make sure you have one of these installed in your PHP environment, before you start.
Define the quality of the encoded image. Data ranging from 0 (poor quality, small file) to 100 (best quality, big file). Default: 60.
<?php
use SaeDigital\JpgCompress\JpgCompress;
$phulp->task('jpg-compress', function ($phulp) {
$jpgCompress = new JpgCompress([
'drive' => 'gd',
'quality' => 15
]);
$phulp
->src(['src/'], '/jpg$/')
->pipe($jpgCompress)
->pipe($phulp->dest('dist/'));
});
$ composer test
If you discover any security related issues, please email ronaldo.rodrigues@saedigital.com.br instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.