I'm using Vich uploader. Everything is fine, I can see the pic I have uploaded. But when there's none, there is a blank, which is kind of ugly. So I decided to upload an icon instead.
I'm trying to do something like: if you don't upload a picture, there will be a default one.
So in my show.index view, I have tried many combinations like:
<div class="col-6">
<div class="d-flex justify-content-center align-items-center">
{% if lieu.imageFile == false %}
<img style="max-width: 100%" src= "{{ vich_uploader_asset(lieu, 'imageFile')}}" >
{% else %}
<img src="{{asset('defaultImage/defaultImage.jpg')}}" alt="">
{% endif %}
</div>
</div>
lieu is my Entity name. ImageFile is the name of the image uploaded.
When I change the if statement to TRUE, it will work, I can see the "defaultImage" I just set up. But then when I go on an other view with no image uploaded, it will show a blank div. Again if I change back to false, it will work. It's like the if statement is only working manually.
I've tried to change the location of the defaultimage I thought it was on conflict with the repository of the vich uploader repository.
I've tried to write, if and if else but it doesn't work neither.
Sorry for my English. Many thanks for your help.