I have the following code. When There is only one image in the backend, the second image shows up with a little question mark instead of nothing. I am looking for a way to check if the image exists first and if so run the code and if not don't.
<?php $image = wp_get_attachment_image_src(get_field('post_image1'), 'thumbnail'); ?>
<img src="<?php echo $image[0]; ?>" alt="<?php get_the_title(get_field('post_image1')) ?>" />
<?php $image = wp_get_attachment_image_src(get_field('post_image2'), 'thumbnail'); ?>
<img src="<?php echo $image[0]; ?>" alt="<?php get_the_title(get_field('post_image2')) ?>" />