docs depage-graphics
Optimizers
Jpegtran.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Depage\Graphics\Optimizers
;
4
5
class
Jpegtran
extends
Optimizer
6
{
7
public
function
__construct
(
$options
= array())
8
{
9
parent::__construct(
$options
);
10
11
if
(isset($this->options[
'jpegtran'
])) {
12
$this->executable = $this->options[
'jpegtran'
];
13
}
14
15
if
(is_null($this->executable)) {
16
$this->executable = \Depage\Graphics\Graphics::which(
"jpegtran"
);
17
}
18
}
19
20
public
function
optimize
($filename)
21
{
22
if
(!$this->executable) {
23
return
false
;
24
}
25
26
$this->command =
"{$this->executable} -optimize "
;
27
28
// @todo test for image size and make progressive only upward a specific size of 10k?
29
$this->command .=
"-progressive "
;
30
$this->command .=
"-copy none "
;
31
$this->command .=
"-outfile "
. escapeshellarg($filename);
32
$this->command .=
" "
. escapeshellarg($filename);
33
34
return
$this->
execCommand
();
35
}
36
}
37
38
/* vim:set ft=php sw=4 sts=4 fdm=marker et : */
Depage\Graphics\Optimizers\Jpegtran
Definition
Jpegtran.php:6
Depage\Graphics\Optimizers\Jpegtran\__construct
__construct($options=array())
Definition
Jpegtran.php:7
Depage\Graphics\Optimizers\Jpegtran\optimize
optimize($filename)
Definition
Jpegtran.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