2013-04-06 70 views
5

我只是想要工作LiipImagineBundle。LiipImagineBundle縮略圖不起作用

好了,我的一切至今:

  • 使用作曲家 安裝
    • $ PHP composer.phar要求 「LIIP /想象束:DEV-大師」
  • 啓用包in AppKernel.php
    • new Liip \ ImagineBundle \ LiipImagineBundle(),
  • 加入的routing.yml
    • _imagine路徑
  • 新增liip_imagine濾波器config.yml

    使用PHP應用程序/控制檯路由器經過:調試和路徑_imagine_my_thumb存在。

但使用後:

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

圖像不渲染,路徑根本就沒有發現錯誤。

prod.log說Route _imagine_my_thumb不存在,儘管它存在,因爲它使用路由器顯示:debug for both environments。

任何提示?

回答

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 

的routing.yml:

_imagine: 
    resource: . 
    type:  imagine 

備註:我的源文件夾在應用程序文件夾(請參閱:data_root)

0

我有類似的問題,並啓用php_fileinfo擴展php.ini渲染後開始工作。