我安装了这个包。使用LiipImagineBundle制作缩略图,但它不起作用。
这是我的安装:
在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;
}然后在我的app/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"我做的最后一件事,就是在我的树枝上放上过滤器
{% 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开发工具点击一张图片,我什么都没有,只有这样的路线:
<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">发布于 2017-08-15 02:13:24
试着这样做!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:Media:liipImagineFilter‘//支付保留费用“
我希望能帮助你
https://stackoverflow.com/questions/44966420
复制相似问题