Symfony2 CSS image samples are overwritten and I get 404

I am using Symfony2 and assetic in an existing project and I cannot figure out how to access images in my CSS. I put my images in:src/Organisation/MyBundle/Resources/public/images/

After starting the installation: php app/console assets:install public

I can load them in the browser correctly: http://sitename/bundles/organisationmy/images/logo.png

However, when I try to point to them in CSS using: url('/bundles/organisationmy/images/logo.png')

checking with firebug, the url changes: url('/web/bundles/organisationmy/images/logo.png')and this leads to 404.

In my main template, I:

{% stylesheets filter='yui_css' output='css/output.css'
    '@MyBundle/Resources/public/css/bootstrap.min.css'
    '@MyBundle/Resources/public/css/bootstrap-responsive.min.css'
    '@MyBundle/Resources/public/css/my.css'
 %}

And in config.ymlI have:

assetic:
    debug: %kernel.debug%
    use_controller: false
    java: /usr/bin/java
    filters:
        cssrewrite: ~
        yui_css:
            jar: %kernel.root_dir%/java/yuicompressor-2.4.7.jar
        yui_js:
            jar: %kernel.root_dir%/java/yuicompressor-2.4.7.jar

In routing.ymlI have:

_assetic:
    resource: .
    type: assetic

I saw this question Symfony2 - Assetic - load images in CSS , but I don’t know if and how to use filter='cssrewrite'it filter='yui_css'at the same time or how to solve the problem.

, Symfony2 CSS /web/, . - , Symfony2?

UPDATE. , url ( "something.png" ), CSS , , - , php app/console assetic:dump - dev CSS ?

UPDATE2. , php app/console assetic:dump --watch .

+5
1

CSS "bundles/(bundle name)/images/(file name)"

UPDATE

,

write_to: %kernel.root_dir%/../web 

assetic: config.yml

background: url('/bundles/(bundle name)/images/prev.png') css

php app/console assets:install web 

php app/console assetic:dump web
+8

All Articles