public function getAsset(string $path, string $mutation = null): string
{
$mutation = empty($mutation) ? '' : "/${mutation}";
$mutation .= $this->config->isAutoMode() ? ',auto' : '';
$originPath = urlencode("{$this->config->getBaseUrl()}{$path}");
return "{$this->config->getPublicUrl()}/ext{$mutation}?src={$originPath}";
}
public function getAsset(string $path, string $mutation = null): string
{
$parts = [];
if($mutation) {
$parts[] = $mutation;
}
if($this->config->isAutoMode()) {
$parts[] = 'auto';
}
$finalMutation = !empty($parts) ? "/" . implode(',', $parts) : '';
$originPath = urlencode("{$this->config->getBaseUrl()}{$path}");
return "{$this->config->getPublicUrl()}/ext{$finalMutation}?src={$originPath}";
}
https://github.com/filejet/filejet-bundle/blob/master/src/Twig/FileJetExtension.php#L40
should looks like e.g