Tell Facebook with image to Share

If you use ShareThis module in Drupal and you want that only article's images appears directly you have to add this code into your template.php file in your theme.


function mytheme_preprocess_page(&$vars){
global $base_url;
$img = $base_url.base_path().path_to_theme()."/logo.png";
if($vars['is_front'] != TRUE){
if(isset($vars['node']->field_image['und'][0]['uri'])){
$img = file_create_url($vars['node']->field_image['und'][0]['uri']);
}
}
$element = array(
'#tag' => 'meta',
'#attributes' => array(
"property" => "og:image",
"content" => $img,
),
);
drupal_add_html_head($element,'facebook_share_image');
}