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

52 views
Skip to first unread message

Marco Alvarez

unread,
Dec 11, 2015, 9:04:45 AM12/11/15
to symfony-cmf-devs
Hello,

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.

Thanks!

David Buchmann

unread,
Dec 11, 2015, 10:30:18 AM12/11/15
to symfony-...@googlegroups.com
hi marco,

i think you miss the configuration for additional_filters. that defines
what other imagine image formats need to be invalidated when an image
changes.

does that help?

cheers,david

On 11.12.2015 15:04, Marco Alvarez wrote:
> Hello,
>
> 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:
>
> |<imgsrc="{{ detail.image.id|imagine_filter('filter_sets') }}">|
>
> or
>
> |<imgsrc="{{ 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.
>
> Thanks!
>
> © C2iS, 2013.
>
> --
> You received this message because you are subscribed to the Google
> Groups "symfony-cmf-devs" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to symfony-cmf-de...@googlegroups.com
> <mailto:symfony-cmf-de...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
Liip AG // Agile Web Development // T +41 43 500 39 80
CH-8005 Zurich // PGP 0xA581808B // www.liip.ch

Marco Alvarez

unread,
Dec 11, 2015, 11:37:18 AM12/11/15
to symfony-...@googlegroups.com
Hello!

Thanks for the answer, but it didn't help me.

I was googling, but I don't fully understand. 

Can you provide a simple example? 

Thanks!



--
You received this message because you are subscribed to a topic in the Google Groups "symfony-cmf-devs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/symfony-cmf-devs/kN8BjZGtFdI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to symfony-cmf-de...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

C2iSMARCO ALVAREZ
Analyste développeur
m.al...@c2is.fr

103 rue Vauban - 69006 Lyon
T. 04 37 24 78 20 - F. 04 37 24 78 21
www.c2is.fr


© C2iS, 2013.

David Buchmann

unread,
Dec 14, 2015, 5:51:57 AM12/14/15
to symfony-...@googlegroups.com
sorry, had the wrong configuration name in my head. its called
extra_filters:

http://symfony.com/doc/current/cmf/bundles/media/configuration.html#extra-filters
> <http://detail.image.id>|imagine_filter('filter_sets') }}">|
> >
> > or
> >
> > |<imgsrc="{{ 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.
> >
> > Thanks!
> >
> > © C2iS, 2013.
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "symfony-cmf-devs" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to symfony-cmf-de...@googlegroups.com
> <mailto:symfony-cmf-devs%2Bunsu...@googlegroups.com>
> > <mailto:symfony-cmf-de...@googlegroups.com
> <mailto:symfony-cmf-devs%2Bunsu...@googlegroups.com>>.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> Liip AG // Agile Web Development // T +41 43 500 39 80
> <tel:%2B41%2043%20500%2039%2080>
> CH-8005 Zurich // PGP 0xA581808B // www.liip.ch <http://www.liip.ch>
>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "symfony-cmf-devs" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/symfony-cmf-devs/kN8BjZGtFdI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> symfony-cmf-de...@googlegroups.com
> <mailto:symfony-cmf-devs%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
>
> C2iS *MARCO ALVAREZ*
> Analyste développeur
> m.al...@c2is.fr <mailto:m.av...@c2is.fr>
> 103 rue Vauban - 69006 Lyon
> T. 04 37 24 78 20 - F. 04 37 24 78 21
> www.c2is.fr <http://www.c2is.fr/>

Marco Alvarez

unread,
Dec 14, 2015, 6:10:03 AM12/14/15
to symfony-cmf-devs
Yes! Perfect, that solved my problem.

Thanks you very much :D

To unsubscribe from this group and all its topics, send an email to symfony-cmf-de...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

C2iSMARCO ALVAREZ
Analyste développeur
m.al...@c2is.fr

103 rue Vauban - 69006 Lyon
T. 04 37 24 78 20 - F. 04 37 24 78 21
www.c2is.fr


© C2iS, 2013.
Reply all
Reply to author
Forward
0 new messages