LiipImagineBundle缩略图不起作用

nyd*_*ann 5 symfony liipimaginebundle

我只想努力工作LiipImagineBundle.

好的,我到目前为止所有:

  • 使用作曲家安装
    • $ php composer.phar需要"liip/imagine-bundle:dev-master"
  • 在AppKernel.php中启用了捆绑包
    • 新的Liip\ImagineBundle\LiipImagineBundle(),
  • 添加到routing.yml
    • _imagine路径
  • 在config.yml中添加了liip_imagine过滤器

    使用php app/console路由器检查:debug和path _imagine_my_thumb存在.

但使用后:

<img src="{{ '/relative/path/to/image.jpg' | imagine_filter('my_thumb') }}" />
Run Code Online (Sandbox Code Playgroud)

图像未渲染,路径根本找不到错误.

prod.log表示Route _imagine_my_thumb不存在,虽然它存在,因为它使用router:debug来显示两种环境.

jay*_*ayv 0

您知道应该替换'/relative/path/to/image.jpg'为图像路径吗?确保您的文件存在。

一个工作示例

配置:

liip_imagine:
    driver:               gd
    web_root:             %kernel.root_dir%/../web
    data_root:            %kernel.root_dir%/../app
    cache_mkdir_mode:     0777
    cache_prefix:         /media/cache
    cache:                web_path
    cache_clearer:        true
    data_loader:          filesystem
    controller_action:    liip_imagine.controller:filterAction
    formats:              []
    filter_sets:
        avatar:
            filters:
                thumbnail: { size: [40, 40], mode: outbound }
        profile:
            filters:
                relative_resize: { widen: 500 }
Run Code Online (Sandbox Code Playgroud)

html:

<img src="{{ 'uploads/images/filename.jpg' | imagine_filter('avatar') }}" alt="image">
enter code here
Run Code Online (Sandbox Code Playgroud)

路由.yml:

_imagine:
    resource: .
    type:     imagine
Run Code Online (Sandbox Code Playgroud)

备注:我的源文件夹位于应用程序文件夹中(请参阅:data_root)