Skip to content

Commit

Permalink
Merge pull request #185 from jan-tricks/main
Browse files Browse the repository at this point in the history
WebP Quality Option
  • Loading branch information
freekmurze authored Feb 28, 2023
2 parents dbbdb55 + 531f95e commit 2d1fe8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/OptimizerChainFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ public static function create(array $config = []): OptimizerChain
{
$jpegQuality = '--max=85';
$pngQuality = '--quality=85';
$webpQuality = '-q 80';
if (isset($config['quality'])) {
$jpegQuality = '--max='.$config['quality'];
$pngQuality = '--quality='.$config['quality'];
$webpQuality = '-q '.$config['quality'];
}

return (new OptimizerChain())
Expand Down Expand Up @@ -48,10 +50,10 @@ public static function create(array $config = []): OptimizerChain
'-O3',
]))
->addOptimizer(new Cwebp([
$webpQuality,
'-m 6',
'-pass 10',
'-mt',
'-q 80',
]));
}
}

0 comments on commit 2d1fe8d

Please sign in to comment.