LiipImagineBundle can't resolve image

拈花ヽ惹草 提交于 2019-12-10 17:34:13

问题


I'm using liipImagineBundle but I can't get it work. Everything is installed correctly, but when I try to apply a filter the resolver doesn't create the image.

<img src="{{ asset('bundles/xy/uploads/images/default/default.png') | imagine_filter('thumb_50x50') }}" />

The generated html code:

<img src="http://social.lh.com/app_dev.php/media/cache/resolve/thumb_50x50/bundles/xy/uploads/images/default/default.png">

If I open a console and call

php app/console liip:imagine:cache:resolve bundles\xy\uploads\images\default\default.png

it works fine after that, because the /media/cache/......./default.png is created now. But I don't want to call it from the console everytime I upload a picture that needs a thumbnail.

I tried to get it done from the controller with:

 $imagemanagerResponse = $this->container
    ->get('liip_imagine.controller')
        ->filterAction(
            $this->getRequest(),
            'bundles\xy\uploads\images\default\default.png',      
            'thumb_50x50'              
);

But then I get the error: Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)

It is strange, because I enabled that extension in php.ini.

Does anyone have any suggestions? Are there any other method is symfony2 to create a thumbnail of a picture?


回答1:


Your code is good, try investigating by:

  1. call directly in the browser the url of the generated html code and see the error message
  2. Then check the extension enabled in the right php.ini files (no CLI) and ...
  3. check you have restarted apache.

Hope this help



来源:https://stackoverflow.com/questions/28266907/liipimaginebundle-cant-resolve-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!