I am using Vichuploader to upload the photos of a category, the problem is that I need to retrieve the image from the css . Background-image and I don't know how to implement the code here.
{{asset ('images/services/')}}{{category.image}} for html template but css ?? style="background-image:url(images/services/image.jpg);"
I am trying this suggestion :
<div class="row">
{% for category in categories %}
<div class="col-md-6 col-lg-6 ftco-animate">
<div class="block-7">
<div class="img prix"
style="background-image: url('{{
vich_uploader_asset(category, 'image') }}')">
</div>
</div>
</div>
{% endfor %}
</div>
You can use vich_uploader_asset()
in a twig file to generate the url for your image:
<div class="img prix"
style="background-image: url('{{ vich_uploader_asset(category, 'imageFile') }}')"
></div>
This twig function is documented here