Is there a way to set what image appears when linking to social media (reddit/fb/etc)?

//FACEBOOK OPENGRAPH
function current_page_url() {
$pageURL = 'http';
if( isset($_SERVER["HTTPS"]) ) {
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;

}

function fb_header() {

$title = get_the_title(); $fb_page = "https://www.facebook.com/mypage"; $link = current_page_url();

if (is_single()) { global $post; $a_post = get_post($post); $post_id = $a_post->ID; $thumbnail = wp_get_attachment_url( get_post_thumbnail_id()); $slug = $a_post->post_name; $author_id=$a_post->post_author; $author_url = get_the_author_meta('user_url', $author_id); $xerpt = substr(strip_tags($a_post->post_content),0,200); }

if (!is_single()) { $title = "Newsmasti.pk" . single_term_title(" - ",FALSE); $thumbnail = "http://newsmasti.pk/wp-content/themes/ospk-new-sidebar-theme/assets/img/logo2.png"; $xerpt = "My website tag line etc"; }

echo "<meta property='og:title' content='".$title."' /> <meta property='og:site_name' content='Mysitename'/> <meta property='og:url' content='".$link."' /> <meta property='og:description' content='".$xerpt."' /> <meta property='og:image' content='".$thumbnail."' /> <meta property='fb:app_id' content='XXXXXXXXX' /> <meta property='og:type' content='article' /> <meta property='og:locale' content='en_US' /> <meta property='article:author' content='".$author_url."' /> <meta property='article:publisher' content='".$fb_page."' />";

}

add_action('wp_head', 'fb_header');

/r/Wordpress Thread