public function filterRuntimeAction(Request $request, $hash, $path, $filter)
    {
        $resolver = $request->get('resolver');
        $runtimeConfig = $request->query->get('filters', []);

        if (!\is_array($runtimeConfig)) {
            throw new NotFoundHttpException(sprintf('Filters must be an array. Value was "%s"', $runtimeConfig));
        }

        if (true !== $this->signer->check($hash, $path, $runtimeConfig)) {
            throw new BadRequestHttpException(sprintf(
                'Signed url does not pass the sign check for path "%s" and filter "%s" and runtime config %s',
                $path,
                $filter,
                json_encode($runtimeConfig)
            ));
        }

        try {
            return new RedirectResponse($this->filterService->getUrlOfFilteredImageWithRuntimeFilters($path, $filter, $runtimeConfig, $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"', $hash.'/'.$path, $filter, $e->getMessage()), 0, $e);
        }
    }
public function filterRuntimeAction(Request $request, $hash, $path, $filter)
    {
        $resolver = $request->get('resolver');
        $runtimeConfig = $request->query->get('filters', []);

        if (!\is_array($runtimeConfig)) {
            throw new NotFoundHttpException(sprintf('Filters must be an array. Value was "%s"', $runtimeConfig));
        }

        if (true !== $this->signer->check($hash, $path, $runtimeConfig)) {
            throw new BadRequestHttpException(sprintf(
                'Signed url does not pass the sign check for path "%s" and filter "%s" and runtime config %s',
                $path,
                $filter,
                json_encode($runtimeConfig)
            ));
        }

        try {
            return new RedirectResponse($this->filterService->getUrlOfFilteredImageWithRuntimeFilters($path, $filter, $runtimeConfig, $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"', $hash.'/'.$path, $filter, $e->getMessage()), 0, $e);
        }
    }
public function filterRuntimeAction ( Request $ request , $ hash , $ path , $ filter ) { $ resolver = $ request -> get ( 'resolver' ) ; $ runtimeConfig = $ request -> query -> get ( 'filters' , [ ] ) ; if ( ! \ is_array ( $ runtimeConfig ) ) { throw new NotFoundHttpException ( sprintf ( 'Filters must be an array. Value was "%s"' , $ runtimeConfig ) ) ; } if ( true !== $ this -> signer -> check ( $ hash , $ path , $ runtimeConfig ) ) { throw new BadRequestHttpException ( sprintf ( 'Signed url does not pass the sign check for path "%s" and filter "%s" and runtime config %s' , $ path , $ filter , json_encode ( $ runtimeConfig ) ) ) ; } try { return new RedirectResponse ( $ this -> filterService -> getUrlOfFilteredImageWithRuntimeFilters ( $ path , $ filter , $ runtimeConfig , $ 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"' , $ hash . '/' . $ path , $ filter , $ e -> getMessage ( ) ) , 0 , $ e ) ; } }
This action applies a given filter -merged with additional runtime filters- 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  $hash
@param string  $path
@param string  $filter

@throws RuntimeException
@throws BadRequestHttpException
@throws NotFoundHttpException

@return RedirectResponse
This action applies a given filter - merged with additional runtime filters - to a given image saves the image and redirects the browser to the stored image .