public function resolve($path, $filter)
{
try {
$binaryFile = $this->ioService->loadBinaryFile($path);
// Treat a MissingBinaryFile as a not loadable file.
if ($binaryFile instanceof MissingBinaryFile) {
throw new NotResolvableException("Variation image not found in {$path}");
}
if ($filter !== static::VARIATION_ORIGINAL) {
$variationPath = $this->getFilePath($path, $filter);
$variationBinaryFile = $this->ioService->loadBinaryFile($variationPath);
$path = $variationBinaryFile->uri;
} else {
$path = $binaryFile->uri;
}
return sprintf('%s%s', $path[0] === '/' ? $this->getBaseUrl() : '', $path);
} catch (NotFoundException $e) {
throw new NotResolvableException("Variation image not found in {$path}", 0, $e);
}
}