R
R
rabotad2020-07-09 16:11:51
Twig
rabotad, 2020-07-09 16:11:51

If the photo is not uploaded, then how to choose a logo?

There is pl.picture in which you can upload an image and you need that if the image is not uploaded, then instead of an empty space there should be a specific picture (/img/default.png)

This code does not work (if I put {% if pl.picture |length > 0 %} , then the second default one is simply added to the loaded image):

<img src="{{ env.getConfig("context_root") }}{{ pl.picture }}"
 style="width: 64px; height: 64px; vertical-align: baseline; float: left;"/>
                    
{% if pl.picture |length < 0 %}

  <img src="{{ env.getConfig("context_root") }}/img/default.png" 
 style="width: 64px; height: 64px; vertical-align: baseline; float: left;>

  {% endif %}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question