dustin10 / VichUploaderBundle

A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
MIT License
1.85k stars 519 forks source link

Vichuploader Background-image #1326

Closed juani0824 closed 1 year ago

juani0824 commented 2 years ago

I would like to know how I can retrieve an image from the css, I would like to add the image using the background-image. I don't know if this is possible. I appreciate your help.

Thanks.

image

This is my code : Entity Category image

VichUploader image

Services image

Thanks you

garak commented 2 years ago

I see HTML in your screenshot, not CSS. You can use the usual helper provided also in our documentation

garak commented 1 year ago

Hello @juani0824 does my response solve your problem? If so, please close this issue.

juani0824 commented 1 year ago

No, no he podido resolver el problema todavía, es código html pero la foto quiero recuperarla desde background-image y no sé cómo hacerlo .

garak commented 1 year ago

Try this (assuming that foo variable contains a reference to your entity)

<div class="img prix" style="background-image: url({{ vich_uploader_asset(foo) }})"></div>
juani0824 commented 1 year ago

thanks for your answer, but I still have an error. image

image

garak commented 1 year ago

I guess that "image" is not the name of your mapped field

garak commented 1 year ago

Closing for missing feedback