我正在尝试为Symfony 4设置Liip,这是文档页面:
https://github.com/liip/LiipImagineBundle
https://symfony.com/doc/master/bundles/LiipImagineBundle/installation.html
我已经运行了composer require liip/imagine-bundle
命令,这是我的liip.yml文件的样子:
liip_imagine:
# configure resolvers
resolvers :
# setup the default resolver
default :
# use the default web path
web_path : ~
# your filter sets are defined here
filter_sets :
# use the default cache configuration
cache : ~
# the name of the "filter set"
my_thumb :
# adjust the image quality to 75%
quality : 75
# list of transformations to apply (the "filters")
filters :
# create a thumbnail: set size to 120x90 and use the "outbound" mode
# to crop the image when the size ratio of the input differs
thumbnail : { size : [120, 90], mode : outbound }
# create a 2px black border: center the thumbnail on a black background
# 4px larger to create a 2px border around the final image
background : { size : [124, 94], position : center, color : '#000000' }
我有一个文件config \ routes \ imagine.yml文件,如下所示:
_liip_imagine:
resource: "@LiipImagineBundle/Resources/config/routing.xml"
这是我的\ config \ bundles.php文件:
< ?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Aws\Symfony\AwsBundle::class => ['all' => true],
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true],
];
我尝试将Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true]
放入我的bundles.php文件中,但这没用。
任何人都可以告诉我我所缺少的吗?
答案 0 :(得分:0)
您应该将此配置放入“ config / routing.yml”而不是“ config / packages / framework.yml”
答案 1 :(得分:0)
SF没有看到liip bundle,主要是缓存问题
首先
您需要在bundles.php中添加包
然后删除/ var / cache目录的全部内容(不是通过bin / console而是手动删除)
答案 2 :(得分:0)
您不使用Symfony Flex吗? 如果使用它,则应该有一个名为config / routes / imagine.yaml的文件,其中包含以下内容:
_liip_imagine:
resource: "@LiipImagineBundle/Resources/config/routing.yaml"
此外,您在配置中导入的是routing.xml而不是routing.yaml ...
是的,您应该将此行添加到config / bundles.php文件中:
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
答案 3 :(得分:0)
您已更改文件composer.json:
"doctrine/doctrine-migrations-bundle": "1.0.*",
之后,在沙盒文件夹中输入以下命令:
composer update