/**
  * {@inheritdoc}
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $ignoreErrors = (bool) $input->getOption('ignore_errors');
     $optimizationLevel = $input->getOption('optimization_level');
     $width = $input->getOption('resize_width');
     $options = array('ignore_errors' => $ignoreErrors, 'gifsicle_options' => array('-b', $optimizationLevel, '--resize-width=' . $width));
     $factory = new OptimizerFactory($options);
     $this->optimizer = $factory->get('gif');
 }
示例#2
0
 /**
  * @test
  */
 public function givenUnsupportedFileForOptimizer_givenIgnoreErrorEnabled_ok()
 {
     $factory = new OptimizerFactory(array('ignore_errors' => true));
     $optimizer = $factory->get('png');
     $optimizer->optimize(__DIR__ . '/Resources/sample.jpg');
 }