5

我只是想让 LiipImagineBundle 工作。

好的,到目前为止我得到的一切:

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

    使用 php app/console 路由器检查:调试和路径 _imagine_my_thumb 存在。

但使用后:

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

图像未呈现,根本找不到路径错误。

prod.log 说 Route _imagine_my_thumb 不存在,尽管它存在,因为它在两种环境中都使用 router:debug 显示。

4

2 回答 2

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 }

html:

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

路由.yml:

_imagine:
    resource: .
    type:     imagine

备注:我的源文件夹在 app 文件夹中(参见:data_root)

于 2013-10-24T11:26:32.123 回答
0

我有类似的问题,在 php.ini 渲染中启用 php_fileinfo 扩展后开始工作。

于 2015-11-23T10:44:30.517 回答