EDITED ANSWER – First get the full file path to your image and store it to a variable $filename. Use file_exists to check if image exists, and output the image and with it the title of your image. If the condition fails, there is no output. https://codex.wordpress.org/Function_Reference/wp_upload_dir
<?php
global $post;
$slug = get_post( $post )->post_name; //get current page slug
$image_name = $post->post_title; //get page name
$upload_dir = wp_upload_dir();
//file_exists needs to check full file path of your hard drive instead of url:
$filename = $_SERVER['DOCUMENT_ROOT']."/wp-content/uploads/" . $slug. '.jpg';
//echo $filename;
if (file_exists($filename)) { //output only when matched
echo '<img src="'. $upload_dir['baseurl']."https://wordpress.stackexchange.com/" . $slug.'.jpg'.'" title="'.$image_name.'" alt="" >';
} else {}
clearstatcache(); //clear cache results of file_exists
?>