首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >LiipImagineBundle - Symfony

LiipImagineBundle - Symfony
EN

Stack Overflow用户
提问于 2017-07-07 16:46:03
回答 1查看 144关注 0票数 0

我安装了这个包。使用LiipImagineBundle制作缩略图,但它不起作用。

这是我的安装:

在Appkernel上

代码语言:javascript
复制
 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;
    }

然后在我的app/config.yml中

代码语言:javascript
复制
liip_imagine:
    resolvers:
       default:
          web_path: ~

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

然后我的路由:

代码语言:javascript
复制
_liip_imagine:
    resource: "@LiipImagineBundle/Resources/config/routing.yaml"

我做的最后一件事,就是在我的树枝上放上过滤器

代码语言:javascript
复制
{% 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

但问题是没有生成图片!你能在这方面帮我吗?

如果我用我的网站的google开发工具点击一张图片,我什么都没有,只有这样的路线:

代码语言:javascript
复制
<img style="width: auto; height: 80px; margin: 10px; border-radius: 10px; border: 1px solid #d2d6de;" src="https://test.hello.org/media/cache/resolve/avatar/uploads/documents/TEST-JEUDI.jpg">

PICTURE OF MY DASHBOARD

EN

回答 1

Stack Overflow用户

发布于 2017-08-15 02:13:24

试着这样做!https://sonata-project.org/bundles/media/master/doc/reference/extra.html

代码语言:javascript
复制
    filter_sets:
        cache: ~
        avatar:
            quality: 75
            controller_action: 'SonataMediaBundle:Media:liipImagineFilter'
            filters:
            thumbnail: { size: [500, 70], mode: outbound }

"controller_action:'SonataMediaBundle:Media:liipImagineFilter‘//支付保留费用“

我希望能帮助你

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44966420

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档