ducin
ducin

Reputation: 26467

symfony2 how to access app/Resources/img from browser?

I've got some project specific images that I don't want to include in any bundle. I'd like to have them accessible from twig layer. The question is: how can I publish them (I can see neither symlinks in web directory nor assetic config in my project). Any hint will be appreciated.

edit: When I run

php app/console assets:install help

I get Installing assets for XxxBundle into web/bundles/xxx, but nothing happens for the app/Resources directory.

Upvotes: 1

Views: 2023

Answers (2)

kratos
kratos

Reputation: 2495

You can publish items in the app/Resources/img by doing:

php app/console assetic:dump --env=prod --no-debug

from the root of the project.

That is where you place system wide libraries.

Upvotes: 0

Michal Trojanowski
Michal Trojanowski

Reputation: 12322

If you really don't want to put them in a bundle you can just place them directly in the web directory. E.g. image.jpg placed in web/appImages/ can be displayed in a template using img src="/appImages/image.jpg" />.

Nevertheless "the Symfony way" encourages you to keep everything within bundles. If you don't want to have the Resources in one specific bundle where your code lives you can have a separate bundle specifically for the application-wide resources.

Upvotes: 2

Related Questions