I am trying to display a user account picture, if the picture field is not 'null' on the base.
If the field is 'empty', then I display the default account picture.
I like {{MYFIELD}}
and {{if my file is defined}}
like it
& lt; Img src = "{% if user.pictureName is zero} {{property ('bundles / nastycodefront / img / userpic.png')}} {% else%} {{property ('upload / image / nastypic_' ~ post. Member ~ '.jpg')}} {% endif%} "alt =" profile picture "& gt;
or
& lt; Img src = "{% if user.pictureName is defined%} {{property ('upload / picture / nastypic_' ~ Post.member ~ '.jpg')}} {% else%} {{property ('bundles / nastycodefront / Img / userpic.png ')}} {% endif%} "alt =" profile picture "& gt;
But trying to get all this custom image.
Do you have an idea of this? Is my code wrong?
Thanks for your help
try it
& lt; Img src = "{% if app.user.pictureName is defined and app.user.pictureName | length & gt; 0%} {{property ('upload / picture / nastypic_' ~ app User.pictureName ~ '.jpg') }} {% Else%} {{property ('bundles / nastycodefront / img / userpic.png')}} {% endif%} "/>
Another great method is using the default filter:
& lt; Img src = "{{app.user.pictureRoute | default ('.png' for 'userpic')}}" />
No comments:
Post a Comment