{% if fiche.imagebf_image is not empty %} {# you can choose width, height (in px) and mode "fit" or "crop" #} {% set imageFileAddr = urlImage({fileName:"files/#{fiche.imagebf_image}",width:200,height:200,mode:"crop"}) %} {% if not(imageFileAddr is same as(false) or imageFileAddr matches '/^\\d+$/') %} {# imageFileAddr is not false or not integer otherwise error #} <img class="center custom-entry" alt="{{ fiche.bf_titre|e('html_attr') }}" src="{{ imageFileAddr }}" /> {% endif %} {% endif %}