public function getImage(EventInterface $event) {
        $request = $event->getRequest();
        $route = $request->getRoute();

        $params = $event->getDatabase()->getShortUrlParams($route->get('shortUrlId'));

        if (!$params) {
            throw new ResourceException('Image not found', 404);
        }

        $route->set('user', $params['user']);
        $route->set('imageIdentifier', $params['imageIdentifier']);
        $route->set('extension', $params['extension']);

        $request->query = new ParameterBag($params['query']);
        $event->getResponse()->headers->set('X-Imbo-ShortUrl', $request->getUri());
        $event->getManager()->trigger('image.get', ['skipAccessControl' => true]);
    }
public function getImage(EventInterface $event) {
        $request = $event->getRequest();
        $route = $request->getRoute();

        $params = $event->getDatabase()->getShortUrlParams($route->get('shortUrlId'));

        if (!$params) {
            throw new ResourceException('Image not found', 404);
        }

        $route->set('user', $params['user']);
        $route->set('imageIdentifier', $params['imageIdentifier']);
        $route->set('extension', $params['extension']);

        $request->query = new ParameterBag($params['query']);
        $event->getResponse()->headers->set('X-Imbo-ShortUrl', $request->getUri());
        $event->getManager()->trigger('image.get', ['skipAccessControl' => true]);
    }
public function getImage ( EventInterface $ event ) { $ request = $ event -> getRequest ( ) ; $ route = $ request -> getRoute ( ) ; $ params = $ event -> getDatabase ( ) -> getShortUrlParams ( $ route -> get ( 'shortUrlId' ) ) ; if ( ! $ params ) { throw new ResourceException ( 'Image not found' , 404 ) ; } $ route -> set ( 'user' , $ params [ 'user' ] ) ; $ route -> set ( 'imageIdentifier' , $ params [ 'imageIdentifier' ] ) ; $ route -> set ( 'extension' , $ params [ 'extension' ] ) ; $ request -> query = new ParameterBag ( $ params [ 'query' ] ) ; $ event -> getResponse ( ) -> headers -> set ( 'X-Imbo-ShortUrl' , $ request -> getUri ( ) ) ; $ event -> getManager ( ) -> trigger ( 'image.get' , [ 'skipAccessControl' => true ] ) ; }
Fetch an image via a short URL

@param EventInterface $event
Fetch an image via a short URL