2013-04-18 99 views
2

我安裝了LiipImagineBundle。LiipImagineBundle和'filter not defined'

config.yml:

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

AppKernel.php:

$bundles = array(
     ... 
     new Liip\ImagineBundle\LiipImagineBundle(), 
    ); 

當我要使用過濾器:

<td><img src="{{ asset('images/zestawy/'~entity.zdjecie) | imagine_filter('my_thumb') }}" /></td> 

我得到這個錯誤:

An exception has been thrown during the rendering of a template ("Filter not defined: my_thumb") 

什麼錯了?

回答

1

你在routing.yml中設置了路由嗎?

_imagine: 
    resource: . 
    type:  imagine 

還要確保您清除緩存

php app/console cache:clear --env="dev" 
php app/console cache:clear --env="prod" 
+0

是的,我做到了,就像指令說。 –

+0

嘗試清除緩存: php app/console cache:清除--env =「dev」和php應用/控制檯緩存:clear --env =「prod」 – Simon

+0

我在開始時刪除了緩存/ dev文件夾。沒事了。 :( –