| @@ 65-75 (lines=11) @@ | ||
| 62 | * @param string $format |
|
| 63 | * @param EncodingOptions $options |
|
| 64 | */ |
|
| 65 | public function convert( |
|
| 66 | Specification $source, |
|
| 67 | Specification $target, |
|
| 68 | $format = Format::JPEG, |
|
| 69 | EncodingOptions $options = null |
|
| 70 | ) { |
|
| 71 | $persistenceListener = new SaveListener($format, $options); |
|
| 72 | $pipeline = $this->converter->createConversion($source, $target); |
|
| 73 | $pipeline->addListener($persistenceListener); |
|
| 74 | $pipeline->run(); |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @param Specification $source |
|
| @@ 83-95 (lines=13) @@ | ||
| 80 | * @param string $format |
|
| 81 | * @param EncodingOptions|null $options |
|
| 82 | */ |
|
| 83 | public function convertAll( |
|
| 84 | Specification $source, |
|
| 85 | array $targets, |
|
| 86 | $format = Format::JPEG, |
|
| 87 | EncodingOptions $options = null |
|
| 88 | ) { |
|
| 89 | $pipelines = $this->converter->createConversions($source, $targets); |
|
| 90 | $listener = new SaveListener($format, $options); |
|
| 91 | foreach ($pipelines as $pipeline) { |
|
| 92 | $pipeline->addListener($listener); |
|
| 93 | $pipeline->run(); |
|
| 94 | } |
|
| 95 | } |
|
| 96 | ||
| 97 | /** |
|
| 98 | * Registers new type handler |
|