Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 8cea9ab

Browse files
authored
Merge pull request #7 from Hoosk/master
Added MozJpeg Tool.
2 parents f270a8f + 6d62021 commit 8cea9ab

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace App\Classes;
4+
5+
use Exception;
6+
use PHPImageOptim\Tools\Common;
7+
use PHPImageOptim\Tools\ToolsInterface;
8+
9+
class MozJpeg extends Common implements ToolsInterface
10+
{
11+
public function optimise()
12+
{
13+
exec($this->binaryPath . ' -quality 90 ' . escapeshellarg($this->imagePath), $aOutput, $iResult);
14+
15+
if ($iResult !== 0) {
16+
throw new Exception('MozJpeg was unable to optimise image.');
17+
}
18+
return $this;
19+
}
20+
public function checkVersion()
21+
{
22+
exec($this->binaryPath . ' --version', $aOutput, $iResult);
23+
}
24+
}

0 commit comments

Comments
 (0)