2017-07-07 31 views
0

我安裝捆綁軟件。 LiipImagineBundle製作縮略圖,但不起作用。LiipImagineBundle - Symfony

這裏是我的安裝:

在Appkernel

class AppKernel extends Kernel 
{ 
    public function registerBundles() 
    { 
     $bundles = [ 
      new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), 
      new Symfony\Bundle\SecurityBundle\SecurityBundle(), 
      new Symfony\Bundle\TwigBundle\TwigBundle(), 
      new Symfony\Bundle\MonologBundle\MonologBundle(), 
      new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), 
      new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), 
      new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), 
      // My admin bundle 
      new AdminBundle\AdminBundle(), 

      // These are the other bundles the SonataAdminBundle relies on 
      new Sonata\CoreBundle\SonataCoreBundle(), 
      new Sonata\BlockBundle\SonataBlockBundle(), 
      new Knp\Bundle\MenuBundle\KnpMenuBundle(), 
      new Liip\ImagineBundle\LiipImagineBundle(), 

      // And finally, the storage and SonataAdminBundle 
      new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(), 
      new Sonata\AdminBundle\SonataAdminBundle(), 
      new UserBundle\UserBundle(), 

      new FOS\UserBundle\FOSUserBundle(), 
      new FOS\JsRoutingBundle\FOSJsRoutingBundle() 
     ]; 

     if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { 
      $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 
      $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 
      $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 
      $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 
     } 

     return $bundles; 
    } 

而且在我的應用程序/ config.yml後

liip_imagine: 
    resolvers: 
     default: 
      web_path: ~ 

    filter_sets: 
     cache: ~ 
     avatar: 
      quality: 75 
      filters: 
       thumbnail: { size: [120, 90], mode: outbound } 

然後我的路由:

_liip_imagine: 
    resource: "@LiipImagineBundle/Resources/config/routing.yaml" 

而我最後一件事是迪d,在我的樹枝上放了過濾器

{% for image in object.image %} 
<li><img style="width: auto; height: 80px; margin: 10px; border-radius: 10px; border: 1px solid #d2d6de;" src="{{ asset('uploads/documents/' ~ image) | imagine_filter('avatar') }}"/></li> 

{% endfor %} 

我在我的網站上創建了一個文件夾。 媒體/緩存與CHMOD 777

但問題是,沒有圖片生成! 你能幫助我在此

如果我點擊着,我已經注意到,但這樣的路徑我的網站的谷歌開發工具的圖片:

<img style="width: auto; height: 80px; margin: 10px; border-radius: 10px; border: 1px solid #d2d6de;" src="https://database.ecotrophelia.org/media/cache/resolve/avatar/uploads/documents/TEST-JEUDI.jpg"> 

PICTURE OF MY DASHBOARD

+0

它是SERVEUR的問題??? –

回答

0

嘗試做這個! https://sonata-project.org/bundles/media/master/doc/reference/extra.html

filter_sets: 
     cache: ~ 
     avatar: 
      quality: 75 
      controller_action: 'SonataMediaBundle:Media:liipImagineFilter' 
      filters: 
      thumbnail: { size: [500, 70], mode: outbound } 

「controller_action: 'SonataMediaBundle:媒體:liipImagineFilter' //付費atention聘請」

我希望能幫助你

+0

我用controller_action嘗試這個,但它不工作 –

相關問題