I think there is a bug in the bundle LiipImagineBundle. I explain:

Here is my new config of the bundle:

    liip_imagine:
        resolvers:
        default:
            web_path:  
                web_root: %kernel.root_dir%/../web/img
                # %kernel.root_dir%/../web/img is the folder where filtered images will be created!
                cache_prefix: media/cache
                # media/cache the prefix of folder where the cached images will be created

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

This is the twig part for displaying the image:

{# This way the filtered image will not be created!#}
<img src="{{ 'img/test.jpg' | imagine_filter('my_thumb') }}" />

{# That way, the filted images will be created. asset() must be used. #}
<img src="{{ asset('img/test.jpg' | imagine_filter('my_thumb')) }}" />

The generated link of the image is not correct! In fact, the obtained link is:

http://localhost/media/cache/my_thumb/img/test.jpg

The expected correct link is:

http://localhost/tuto/web/img/media/cache/my_thumb/img/test.jpg

There is a missing part in the url: tuto/web/img . Is this a bug?

To avoid that problem, I did this:

<img src="{{ asset('img/test.jpg' | imagine_filter('my_thumb'))|replace({'media':'tuto/web/img/media'}) }}" />

I guess that playing with twig is not a good solution.

It is a bug in LiipImagineBundle? If not, please give the correct config for that bundle!

Thanks!

有帮助吗?

解决方案

I found finally the solution on github.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top