I am using a simple if / else in a WordPress loop, with use of "Advanced custom field" plugin and I am loading an image and if not present, I want to load a fallback image. While using this loop, Wordpress shows both if and else conditions in the same time. What am I doing wrong? Many thanks for your help and advice.
<img class="profilepicture" src="<?php if (!empty(the_field('authors_image')))
{ the_field('authors_image'); } else { echo(bloginfo('template_url') . "/img/profile.svg"); } ?>" alt=" profile ">
This is the result in html
<img class="profilepicture" src="http://example.com/wp-content/uploads/2016/12/picture-60966-516ob1f.jpghttp://example.com/wp-content/themes/IranDarJahan/img/profile.svg" alt=" profile ">