How to format PHP if statement? [closed]

Just some slight syntax errors in your formatting. This should help:

<?php if ( function_exists( 'z_taxonomy_image' ) ) { ?>
    <img alt="" src="https://wordpress.stackexchange.com/questions/236591/<?php if ( function_exists("z_taxonomy_image_url' ) ) { echo z_taxonomy_image_url( $child->term_id ); } ?>" />
<?php } else { ?>
    <img alt="<?php esc_html( get_the_title() ) ?>" src="<?php esc_url( get_template_directory_uri() . '/assets/images/blank325_170.png' ) ?>">
<?php } ?>