diff --git a/src/Configuration/ConfigurationDefaults.php b/src/Configuration/ConfigurationDefaults.php index b097853..c1b6a27 100644 --- a/src/Configuration/ConfigurationDefaults.php +++ b/src/Configuration/ConfigurationDefaults.php @@ -150,10 +150,10 @@ public function __construct(&$settings) { 'chain' => 'rtf->ps->pdf', ), ), - 'webp->jpg' => array( - 'webp->png->jpg' => array( + 'webp->(jpg|gif|svg|tiff|wmf)' => array( + 'webp->png->img' => array( '#engine' => 'Chain', - 'chain' => 'webp->png->jpg', + 'chain' => 'webp->png->*', ), ), 'webp->png' => array( @@ -161,10 +161,10 @@ public function __construct(&$settings) { '#engine' => 'Convert\\WebP', ), ), - 'jpg->webp' => array( + '(jpg|gif|svg|tiff|wmf)->webp' => array( 'jpg->png->webp' => array( '#engine' => 'Chain', - 'chain' => 'jpg->png->webp', + 'chain' => '*->png->webp', ), ), 'png->webp' => array( diff --git a/src/Engine/Chain.php b/src/Engine/Chain.php index 0325756..7547b46 100644 --- a/src/Engine/Chain.php +++ b/src/Engine/Chain.php @@ -14,6 +14,15 @@ class Chain extends EngineBase { public function convertFile($source, $destination) { $links = explode('->', $this->configuration['chain']); + // Allow wildcards for the start/end + if ($links[0] === '*') { + $links[0] = $this->conversion[0]; + } + if ($links[sizeof($links) - 1] === '*') { + $links[sizeof($links) - 1] = $this->conversion[1]; + } + + // Iterate through the chain. $s_path = $this->getTempFile(array_shift($links)); copy($source, $s_path); while (!empty($links)) {