/** * Gets url of image * * @param string $relativeName Relative Path * @param string $filter Filter Service * @return string */ public function __invoke($relativeName, $filter) { $filterOptions = $this->filterManager->getFilterOptions($filter); if (isset($filterOptions['format'])) { $format = $filterOptions['format']; } else { $binary = $this->loaderManager->loadBinary($relativeName, $filter); $format = $binary->getFormat() ?: 'png'; } if ($this->cacheManager->isCachingEnabled($filter, $filterOptions) && $this->cacheManager->cacheExists($relativeName, $filter, $format)) { $basePathHelper = $this->getView()->plugin('basePath'); return $basePathHelper() . '/' . $this->cacheManager->getCacheUrl($relativeName, $filter, $format); } $urlHelper = $this->getView()->plugin('url'); return $urlHelper('htimg/display', ['filter' => $filter], ['query' => ['relativePath' => $relativeName]]); }
/** * {@inheritDoc} */ public function getCacheUrl(UserInterface $user, $filter) { return $this->cacheManager->getCacheUrl('user/' . $user->getId(), $filter, $this->storageModel->getUserImageExtension()); }