docs depage-graphics
Optimizers
Jpegoptim.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Depage\Graphics\Optimizers
;
4
5
class
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 : */
Depage\Graphics\Optimizers\Jpegoptim
Definition
Jpegoptim.php:6
Depage\Graphics\Optimizers\Jpegoptim\__construct
__construct($options=array())
Definition
Jpegoptim.php:7
Depage\Graphics\Optimizers\Jpegoptim\optimize
optimize($filename)
Definition
Jpegoptim.php:20
Depage\Graphics\Optimizers\Optimizer
Definition
Optimizer.php:6
Depage\Graphics\Optimizers\Optimizer\$options
$options
Definition
Optimizer.php:9
Depage\Graphics\Optimizers\Optimizer\execCommand
execCommand()
Definition
Optimizer.php:16
Depage\Graphics\Optimizers
Definition
Jpegoptim.php:3