I would like to get the absolute path of the source image before calling the liip resolver (with the relative path to the image), so that if the image is not there I can dispatch a request to download it.
But I can't figure out how to get that path without re-creating the logic that exists in the Liip Imagine service.
$path = $this->imageCacheManager->getSourcePath($relativePath);
if (!file_exists($path)) $this->downloadImage($relativePath);
I realize that file_exists should be replaced with the Flysystem call, so I guess what may be needed is a way to get the filesystem.
loaders:
flysystem_loader:
flysystem:
# this comes from flysystem.yaml
filesystem_service: images_filesystem
# default loader to use for all filter sets
data_loader: flysystem_loader
$loader = $this->imageCacheManager->getLoader();
//
$path = $this->imageCacheManager->getSourcePath($relativePath);
if (!$loader->fileExists($path)) $this->downloadImage($relativePath);
I've poked around in the code, but the methods I see are private. Is there a way to get what I'm looking for? Since I'm using the local filesystem, I can hack in something that uses the same path that's defined in Flysystem, but that seems precarious.
I would like to get the absolute path of the source image before calling the liip resolver (with the relative path to the image), so that if the image is not there I can dispatch a request to download it.
But I can't figure out how to get that path without re-creating the logic that exists in the Liip Imagine service.
That is, I can get the browser path:
What I want is to get the absolute path.
I realize that file_exists should be replaced with the Flysystem call, so I guess what may be needed is a way to get the filesystem.
I've poked around in the code, but the methods I see are private. Is there a way to get what I'm looking for? Since I'm using the local filesystem, I can hack in something that uses the same path that's defined in Flysystem, but that seems precarious.