From 6d6202155b136d503b99ab2d53796aac2c5b8610 Mon Sep 17 00:00:00 2001 From: Oscar Date: Thu, 13 Apr 2017 16:51:44 +0200 Subject: [PATCH] Added MozJpeg Tool. --- src/PHPImageOptim/Tools/Jpeg/MozJpeg.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/PHPImageOptim/Tools/Jpeg/MozJpeg.php diff --git a/src/PHPImageOptim/Tools/Jpeg/MozJpeg.php b/src/PHPImageOptim/Tools/Jpeg/MozJpeg.php new file mode 100644 index 0000000..3160ede --- /dev/null +++ b/src/PHPImageOptim/Tools/Jpeg/MozJpeg.php @@ -0,0 +1,24 @@ +binaryPath . ' -quality 90 ' . escapeshellarg($this->imagePath), $aOutput, $iResult); + + if ($iResult !== 0) { + throw new Exception('MozJpeg was unable to optimise image.'); + } + return $this; + } + public function checkVersion() + { + exec($this->binaryPath . ' --version', $aOutput, $iResult); + } +} \ No newline at end of file