phpsymfonysymfony-cmfsonata-media-bundle

Symfony CMF Media Bundle invalidate image; the front doesn't reload the cached image


My problem is the following:

When I change an image in the Symfony CMF admin, it changes in the admin (the image changes in the admin side, everything good); but in the front side I don't see the change. I see the old image, and it only refresh if I delete all the cache in the folder /web/media/cache/*

How can I solve this?

My config:

liip_imagine:
    filter_sets:
        article_main_image:
            data_loader: cmf_media_doctrine_phpcr
            filters:
                thumbnail: { size: [480, 360], mode: outbound }
    filter_2: 
        ...

cmf_media:
    persistence:
        phpcr:
            enabled: true

To display the image is just do something like:

<img src="{{ detail.image.id|imagine_filter('filter_sets') }}">

or

<img src="{{ cmf_media_display_url(item.image, { imagine_filter : "filter_sets" }) }}">

The imagine_filter works perfect, but the image never gets updated when I change it from the admin.

The url of a normal image is:

http://local.my_example_project.com/media/cache/resolve/testBlock/myproject/test/test_father_1447068394/test_child_1447068468/image

and when I change the image, the name 'image' doesn't change, because it's the name of the field in the document/form.

Well I'm lost, I tried everything. I don't get why in the sonata admin, image changes; but in the front it doesn't.


Solution

  • Well, I found the solution in a google group:

    There was a configuration missing:

    cmf_media:
        extra_filters:
            - imagine_filter_name1
            - imagine_filter_name2
    

    source: http://symfony.com/doc/current/cmf/bundles/media/configuration.html#extra-filters