public function coverAction($id, Request $request)
    {
        $body = $this->getAnime($id);
        /* @var $response Response */
        $response = $this->get('cache_time_keeper')->getResponse([], self::CACHE_LIFETIME)
            ->setEtag(sha1($body->html()));
        $response->headers->set('Content-Type', 'image/jpeg');

        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        if ($image = $body->filter('picture')->text()) {
            $image = $this->get('anime_db.ani_db.browser')->getImageUrl($image);
            $image_response = (new Client())->get($image)->send();
            if (!$image_response->isSuccessful()) {
                throw new \RuntimeException('Failed download image from anidb.net');
            }
            $response->setContent($image_response->getBody(true));
        } else {
            throw $this->createNotFoundException('Cover not found');
        }

        return $response;
    }
public function coverAction($id, Request $request)
    {
        $body = $this->getAnime($id);
        /* @var $response Response */
        $response = $this->get('cache_time_keeper')->getResponse([], self::CACHE_LIFETIME)
            ->setEtag(sha1($body->html()));
        $response->headers->set('Content-Type', 'image/jpeg');

        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        if ($image = $body->filter('picture')->text()) {
            $image = $this->get('anime_db.ani_db.browser')->getImageUrl($image);
            $image_response = (new Client())->get($image)->send();
            if (!$image_response->isSuccessful()) {
                throw new \RuntimeException('Failed download image from anidb.net');
            }
            $response->setContent($image_response->getBody(true));
        } else {
            throw $this->createNotFoundException('Cover not found');
        }

        return $response;
    }
public function coverAction ( $ id , Request $ request ) { $ body = $ this -> getAnime ( $ id ) ; /* @var $response Response */ $ response = $ this -> get ( 'cache_time_keeper' ) -> getResponse ( [ ] , self :: CACHE_LIFETIME ) -> setEtag ( sha1 ( $ body -> html ( ) ) ) ; $ response -> headers -> set ( 'Content-Type' , 'image/jpeg' ) ; // response was not modified for this request if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } if ( $ image = $ body -> filter ( 'picture' ) -> text ( ) ) { $ image = $ this -> get ( 'anime_db.ani_db.browser' ) -> getImageUrl ( $ image ) ; $ image_response = ( new Client ( ) ) -> get ( $ image ) -> send ( ) ; if ( ! $ image_response -> isSuccessful ( ) ) { throw new \ RuntimeException ( 'Failed download image from anidb.net' ) ; } $ response -> setContent ( $ image_response -> getBody ( true ) ) ; } else { throw $ this -> createNotFoundException ( 'Cover not found' ) ; } return $ response ; }
Get cover from anidb.net item id.

@param string $id
@param Request $request

@return Response
Get cover from anidb . net item id .