Jpegtran.php
Go to the documentation of this file.
1<?php
2
4
5class 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 : */