Jpegoptim.php
Go to the documentation of this file.
1<?php
2
4
5class Jpegoptim extends Optimizer
6{
7 public function __construct($options = array())
8 {
9 parent::__construct($options);
10
11 if (isset($this->options['jpegoptim'])) {
12 $this->executable = $this->options['jpegoptim'];
13 }
14
15 if (is_null($this->executable)) {
16 $this->executable = \Depage\Graphics\Graphics::which("jpegoptim");
17 }
18 }
19
20 public function optimize($filename)
21 {
22 if (!$this->executable) {
23 return false;
24 }
25
26 $this->command = "{$this->executable} --strip-all";
27
28 // jpegoptim unfortunately does not support progressive jpgs
29
30 $this->command .= " " . escapeshellarg($filename);
31
32 return $this->execCommand();
33 }
34}
35
36/* vim:set ft=php sw=4 sts=4 fdm=marker et : */