2017-07-07 58 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尝试这个,但它不工作 –