first step:
this snippet would get the url of the image that would show closest to the top of a post:
// kudos to: https://www.livexp.net/wordpress/get-the-first-image-from-the-wordpress-post-and-display-it.html
$first_img = '';
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
(there are other ways to get an attachment image from a post; you should get results using the forum search.)
the linking to single.php (this code has to be in a wordpress loop):
<a href="<?php echo the_permalink() ?>" title="link to <?php the_title(); ?>"><img src="<?php echo $first_img; ?>" alt="image of: <?php the_title(); ?>" class="first_image aligncenter" /></a>
you can use the css class .first_image
to style your 5px white border:
img.first_image { padding: 5px;
background-color: #fff; }
the alignment should work if your theme has the ‘normal’ styles for image alignment.
third step:
look for instructions with the plugin?