} catch (NotLoadableException $exception) {
if (null !== $this->dataManager->getDefaultImageUrl($filter)) {
return new RedirectResponse($this->dataManager->getDefaultImageUrl($filter));
}
throw new NotFoundHttpException(sprintf('Source image for path "%s" could not be found', $path), $exception);
} catch (NonExistingFilterException $exception) {
throw new NotFoundHttpException(sprintf('Requested non-existing filter "%s"', $filter), $exception);
} catch (RuntimeException $exception) {
throw new \RuntimeException(vsprintf('Unable to create image for path "%s" and filter "%s". Message was "%s"', [
$hash ? sprintf('%s/%s', $hash, $path) : $path,
public function filterAction(Request $request, $path, $filter)
{
$path = PathHelper::urlPathToFilePath($path);
$resolver = $request->get('resolver');
return $this->createRedirectResponse(function () use ($path, $filter, $resolver, $request) {
return $this->filterService->getUrlOfFilteredImage(
$path,
$filter,
$resolver,
$this->isWebpSupported($request)
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
/**
* {@inheritdoc}
*/
public function find($path)
{
$path = $this->locator->locate($path);
$mimeType = $this->mimeTypeGuesser instanceof DeprecatedMimeTypeGuesserInterface ? $this->mimeTypeGuesser->guess($path) : $this->mimeTypeGuesser->guessMimeType($path);
$extension = $this->getExtension($mimeType);
return new FileBinary($path, $mimeType, $extension);
}
*
* @return BinaryInterface
*/
private function createFilteredBinary(FilterPathContainer $filterPathContainer, string $filter): BinaryInterface
{
$binary = $this->dataManager->find($filter, $filterPathContainer->getSource());
try {
return $this->filterManager->applyFilter($binary, $filter, $filterPathContainer->getOptions());
} catch (NonExistingFilterException $e) {
$this->logger->debug(sprintf(
*/
public function getUrlOfFilteredImage($path, $filter, $resolver = null, bool $webpSupported = false)
{
$basePathContainer = new FilterPathContainer($path);
return $this->getUrlOfFilteredImageByContainer($basePathContainer, $filter, $resolver, $webpSupported);
}
/**
* @param string $path
* @param string $filter
* @return RedirectResponse
*/
private function createRedirectResponse(\Closure $url, string $path, string $filter, ?string $hash = null): RedirectResponse
{
try {
return new RedirectResponse($url(), $this->controllerConfig->getRedirectResponseCode());
} catch (NotLoadableException $exception) {
if (null !== $this->dataManager->getDefaultImageUrl($filter)) {
return new RedirectResponse($this->dataManager->getDefaultImageUrl($filter));
}
public function filterAction(Request $request, $path, $filter)
{
$path = PathHelper::urlPathToFilePath($path);
$resolver = $request->get('resolver');
return $this->createRedirectResponse(function () use ($path, $filter, $resolver, $request) {
return $this->filterService->getUrlOfFilteredImage(
$path,
$filter,
$resolver,
$this->isWebpSupported($request)
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
No log messages
[2/2] NotFoundHttpException |
---|
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: Source image for path "fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg" could not be found at vendor/liip/imagine-bundle/Controller/ImagineController.php:170 at Liip\ImagineBundle\Controller\ImagineController->createRedirectResponse(object(Closure), 'fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg', 'sylius_shop_product_original') (vendor/liip/imagine-bundle/Controller/ImagineController.php:95) at Liip\ImagineBundle\Controller\ImagineController->filterAction(object(Request), 'fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg', 'sylius_shop_product_original') (vendor/symfony/http-kernel/HttpKernel.php:158) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:80) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:201) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (public/index.php:49) |
[1/2] NotLoadableException |
---|
Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException: Source image not resolvable "fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg" in root path(s) "/home/raritaneng/ecommerce/production/public/media/image" at vendor/liip/imagine-bundle/Binary/Locator/FileSystemLocator.php:52 at Liip\ImagineBundle\Binary\Locator\FileSystemLocator->locate('fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg') (vendor/liip/imagine-bundle/Binary/Loader/FileSystemLoader.php:75) at Liip\ImagineBundle\Binary\Loader\FileSystemLoader->find('fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg') (vendor/liip/imagine-bundle/Imagine/Data/DataManager.php:136) at Liip\ImagineBundle\Imagine\Data\DataManager->find('sylius_shop_product_original', 'fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg') (vendor/liip/imagine-bundle/Service/FilterService.php:186) at Liip\ImagineBundle\Service\FilterService->createFilteredBinary(object(FilterPathContainer), 'sylius_shop_product_original') (vendor/liip/imagine-bundle/Service/FilterService.php:161) at Liip\ImagineBundle\Service\FilterService->getUrlOfFilteredImageByContainer(object(FilterPathContainer), 'sylius_shop_product_original', null, false) (vendor/liip/imagine-bundle/Service/FilterService.php:110) at Liip\ImagineBundle\Service\FilterService->getUrlOfFilteredImage('fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg', 'sylius_shop_product_original', null, false) (vendor/liip/imagine-bundle/Controller/ImagineController.php:100) at Liip\ImagineBundle\Controller\ImagineController->Liip\ImagineBundle\Controller\{closure}() (vendor/liip/imagine-bundle/Controller/ImagineController.php:164) at Liip\ImagineBundle\Controller\ImagineController->createRedirectResponse(object(Closure), 'fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg', 'sylius_shop_product_original') (vendor/liip/imagine-bundle/Controller/ImagineController.php:95) at Liip\ImagineBundle\Controller\ImagineController->filterAction(object(Request), 'fileslibrary/mobile/products/152/raritan-engineering-company-marine-elegance-electric-marine-toilet-specifications-3.jpg', 'sylius_shop_product_original') (vendor/symfony/http-kernel/HttpKernel.php:158) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:80) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:201) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (public/index.php:49) |