public function renderAction()
    {   
        $filepath = $this->getRequest()->get('filepath');
        $hash = $this->getRequest()->get('hash');
        $filter = $this->getRequest()->get('filter');
        $tag = md5($hash . $filter);
        
        $response = new Response();
        $response->setPublic();
        $response->setEtag($tag);
        
        if($response->isNotModified($this->getRequest())){
            return $response;
        }
        
        $imageManager = $this->container->get('thrace_media.imagemanager');
        $filterManager = $this->container->get('liip_imagine.filter.manager');

        try{
            $image = $imageManager->loadPermanentImageByName($filepath);
        } catch (FileNotFound $e){
            throw new NotFoundHttpException();
        }


        $filteredImage = $filterManager->applyFilter($image, $filter);
        
        $content = $filteredImage->get($imageManager->getExtension($filepath));
        $response->setContent($content);
        $response->headers->set('Accept-Ranges', 'bytes');
        $response->headers->set('Content-Length', mb_strlen($content));
        $response->headers->set('Content-Type', $this->getMimeType($content));
        
        return $response;
    }