致命错误:Class' Imagine \ Gd \ Imagine' - Symfony 2框架

时间:2015-11-20 14:13:45

标签: symfony composer-php liipimaginebundle

我试图在symfony 2中实现liipbundle。但是当我将这个imag_filter(' thumbnail')添加到图像中时,它会返回错误:

  

致命错误:Class' Imagine \ Gd \ Imagine'找不到   /home/piripz8g/public_html/app/cache/prod/appProdProjectContainer.php   在第588行

这是配置文件中的代码:

liip_imagine:
    resolvers:
       default:
          web_path: ~

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

路由:

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

appKernel:

    new Liip\ImagineBundle\LiipImagineBundle(),

树枝:

{{ asset(f.path|imagine_filter('thumbnail')) }}

2 个答案:

答案 0 :(得分:0)

我想你忘了把包添加到app / AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Liip\ImagineBundle\LiipImagineBundle(),
        );

        // ...
    }

    // ...
}

答案 1 :(得分:0)

似乎没有加载php5-gd。您可以验证是否加载了php5-gd,输入以下命令:

$ php5 -m | grep -i gd

如果没有加载......

$ sudo apt-get install php5-gd
$ sudo service apache2 restart