Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

saedigital/phulp-jpg-compress

Repository files navigation

Build Status Scrutinizer Code Quality Code Intelligence Status Code Coverage

phulp-jpg-compress

The jpg-compress addon for PHULP. It's a wrapper for intervention/image.

Install

$ composer require saedigital/phulp-jpg-compress

Usage

<?php

use SaeDigital\JpgCompress\JpgCompress;

$phulp->task('jpg-compress', function ($phulp) {
    
    $phulp
        ->src(['src/'], '/jpg$/')
        ->pipe(new JpgCompress)
        ->pipe($phulp->dest('dist/'));
});

Parameters

Driver

Image processing extensions.

  • GD
  • Imagick (default)

Make sure you have one of these installed in your PHP environment, before you start.

Quality

Define the quality of the encoded image. Data ranging from 0 (poor quality, small file) to 100 (best quality, big file). Default: 60.

Example

<?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/'));
});

Testing

$ composer test

Security

If you discover any security related issues, please email ronaldo.rodrigues@saedigital.com.br instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.