*/ class PngoutFilter implements FilterInterface { const COLOR_GREY = '0'; const COLOR_RGB = '2'; const COLOR_PAL = '3'; const COLOR_GRAY_ALPHA = '4'; const COLOR_RGB_ALPHA = '6'; const FILTER_NONE = '0'; const FILTER_X = '1'; const FILTER_Y = '2'; const FILTER_X_Y = '3'; const FILTER_PAETH = '4'; const FILTER_MIXED = '5'; const STRATEGY_XTREME = '0'; const STRATEGY_INTENSE = '1'; const STRATEGY_LONGEST_MATCH = '2'; const STRATEGY_HUFFMAN_ONLY = '3'; const STRATEGY_UNCOMPRESSED = '4'; private $pngoutBin; private $color; private $filter; private $strategy; private $blockSplitThreshold; /** * Constructor. * * @param string $pngoutBin Path to the pngout binary */ public function __construct($pngoutBin = '/usr/bin/pngout') { $this->pngoutBin = $pngoutBin; } public function setColor($color) { $this->color = $color; } public function setFilter($filter) { $this->filter = $filter; } public function setStrategy($strategy) { $this->strategy = $strategy; } public function setBlockSplitThreshold($blockSplitThreshold) { $this->blockSplitThreshold = $blockSplitThreshold; } public function filterLoad(AssetInterface $asset) { } public function filterDump(AssetInterface $asset) { $pb = new ProcessBuilder(array($this->pngoutBin)); if (null !== $this->color) { $pb->add('-c'.$this->color); } if (null !== $this->filter) { $pb->add('-f'.$this->filter); } if (null !== $this->strategy) { $pb->add('-s'.$this->strategy); } if (null !== $this->blockSplitThreshold) { $pb->add('-b'.$this->blockSplitThreshold); } $pb->add($input = tempnam(sys_get_temp_dir(), 'assetic_pngout')); file_put_contents($input, $asset->getContent()); $output = tempnam(sys_get_temp_dir(), 'assetic_pngout'); unlink($output); $pb->add($output .= '.png'); $proc = $pb->getProcess(); $code = $proc->run(); if (0 < $code) { unlink($input); throw new \RuntimeException($proc->getErrorOutput()); } $asset->setContent(file_get_contents($output)); unlink($input); unlink($output); } } __halt_compiler();----SIGNATURE:----ExnmPCyYJwbrZNinwyX8BpP7zzGzqWM6qEekJn8hbZ7v6WVKGEIv36s8i1YT8pHHdXdu82GkqDge7JpuNKHMQM4q7ixYdp1kVRgmAGgdF4pojSp/vsGEk2NNWNOp0PViMd0BVVWRHd0AeYnoSvlOGnvNzPQlNL6hxUMVUgv6z4oVOZmHfEhyAIwFYhi0muxFQXf3IaWxbcmMirYdwMbAP3IzKYZO2JyVO8/lQ9T3twr87rIXdcX5P8iTGaVG0s0YUdeyJWWrQfTB7XaDAug1aPU11DjHJN/A5zeF1LOil8dpoxP3z7/KF/tBl6ShOpJsFEQTKiSNUi4OflZtOs1mTIq9LB1fLQMmAGi6uld6uaAhlwg1Q3FVYx04lsWdFxRC6c35MIP714HyhzVlqqnx7sbLWrN8xGEDgu730wqO7SCXagyLQwKD2IY1gx86C59zl3n3JghBAw+OVoddbWQ39bxN23if4VkzSx7pR0kvaBUILrAV3tjSCNcv1XIT9LOyt0umS8JFqDPa7lzy902ZtUIhU/NR7Db9w7wzuwF1On9JSBk5I3Uy6G5+VJyBzE3hkdkNXo5lEU5wZpXoC7mpah4Hli5cYAV0/6SvZFirbyUWn42xzSYcfuLzF/MhmLBWA3eP74vpNGET7bDuAZtNjwW3gzfrjuNHrQQ4bTVP6Jo=----ATTACHMENT:----NjQzNTM5NDAwNDYwNzE1NCA3OTkzNzA2ODkxNDYxMjE2IDU5MDcxODI3Njk4ODcxNDE=