public function filterAction(Request $request, $path, $filter)
    {
        $path = PathHelper::urlPathToFilePath($path);
        $resolver = $request->get('resolver');

        try {
            return new RedirectResponse($this->filterService->getUrlOfFilteredImage($path, $filter, $resolver), 301);
        } catch (NotLoadableException $e) {
            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));
        } catch (NonExistingFilterException $e) {
            throw new NotFoundHttpException(sprintf('Requested non-existing filter "%s"', $filter));
        } catch (RuntimeException $e) {
            throw new \RuntimeException(sprintf('Unable to create image for path "%s" and filter "%s". Message was "%s"', $path, $filter, $e->getMessage()), 0, $e);
        }
    }
public function filterAction(Request $request, $path, $filter)
    {
        $path = PathHelper::urlPathToFilePath($path);
        $resolver = $request->get('resolver');

        try {
            return new RedirectResponse($this->filterService->getUrlOfFilteredImage($path, $filter, $resolver), 301);
        } catch (NotLoadableException $e) {
            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));
        } catch (NonExistingFilterException $e) {
            throw new NotFoundHttpException(sprintf('Requested non-existing filter "%s"', $filter));
        } catch (RuntimeException $e) {
            throw new \RuntimeException(sprintf('Unable to create image for path "%s" and filter "%s". Message was "%s"', $path, $filter, $e->getMessage()), 0, $e);
        }
    }
public function filterAction ( Request $ request , $ path , $ filter ) { $ path = PathHelper :: urlPathToFilePath ( $ path ) ; $ resolver = $ request -> get ( 'resolver' ) ; try { return new RedirectResponse ( $ this -> filterService -> getUrlOfFilteredImage ( $ path , $ filter , $ resolver ) , 301 ) ; } catch ( NotLoadableException $ e ) { 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 ) ) ; } catch ( NonExistingFilterException $ e ) { throw new NotFoundHttpException ( sprintf ( 'Requested non-existing filter "%s"' , $ filter ) ) ; } catch ( RuntimeException $ e ) { throw new \ RuntimeException ( sprintf ( 'Unable to create image for path "%s" and filter "%s". Message was "%s"' , $ path , $ filter , $ e -> getMessage ( ) ) , 0 , $ e ) ; } }
This action applies a given filter to a given image, saves the image and redirects the browser to the stored
image.

The resulting image is cached so subsequent requests will redirect to the cached image instead applying the
filter and storing the image again.

@param Request $request
@param string  $path
@param string  $filter

@throws RuntimeException
@throws NotFoundHttpException

@return RedirectResponse
This action applies a given filter to a given image saves the image and redirects the browser to the stored image .