how do i share an image on facebook? - facebook

I read about that I have to include this in my head tag
<meta property="og:title" content="<?php echo $photo['photo_name']; ?>" />
<meta property="og:description" content="<?php echo $photo['description']; ?>" />
<meta property="og:url" content="<?php echo $url; ?>detail.php?id=<?php echo $id; ?>" />
<meta property="og:image" content="<?php echo $canvas_url. 'libs/upload/upload/' .$photo['user_id'] .'/miniatury/' .$photo['name']; ?>" />
<meta property="og:image:secure_url" content="<?php echo $canvas_url. 'libs/upload/upload/' .$photo['user_id'] .'/miniatury/' .$photo['name']; ?>" />
<meta property="fb:app_id" content="<?php echo $appId; ?>
the php script is correct , but still i don't get anything when i share an image. I got this :
how can i manage that ? thx

You want to publish a feed, where you want to show an image too right?
Define og:picture tag. Eg:
<meta property="og:picture" ....>

Related

Facebook Share Meta Tags

I have my meta tags working until I changed it to be appeared only when a certain page is loaded.
This is my code:
<title>
Effro | <?php echo isset($metatitle) ? $metatitle : 'Homepage'; ?>
</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--Facebook og -->
<meta property="fb:app_id" content="1247181518629773" />
<?php
if(isset($is_ref) && $is_ref):
?>
<meta property="og:type" content="website" />
<meta property="og:title" content="Effro - We Solve Your Ambitious Event" />
<meta property="og:description" content="This i s a test Description" />
<meta property="og:image" content="<?php echo base_url().'assets/img/Effro_Facebook_Share.jpg'; ?>" />
<meta property="og:url" content="<?php echo site_url().'talents/referral'; ?>" />
<?php
endif;
?>
I tried Open Graph Object Debugger several times. But it is not picking up the values.

FB Share this link doesn't fetch post desc and thumb

On a wordpress site, I'm using sharethis plugin...
http://support.sharethis.com/customer/portal/articles/446440-wordpress-integration
Where FB Share Link Button doesn't fetch and display Post description & image on facebook.
Any idea/hint what could be wrong?
Please add this function into your functions.php file.
function wpc_fb_opengraph() {
$wpc_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
?>
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="fb:app_id" content="APP ID HERE">
<meta property="fb:admins" content="YOUR FB USER ID (OR USERNAME) HERE"/>
<meta property="og:image" content="<?php echo $wpc_image_url[0] ?>"/>
<?php }
add_action('wp_head', 'wpc_fb_opengraph');
Note : if you haven't yet any facebook app for your web pages you dont have to use this lines .
<meta property="fb:app_id" content="APP ID HERE">
<meta property="fb:admins" content="YOUR FB USER ID (OR USERNAME) HERE"/>
Happy Wordpress..
You might want to try implemented the Open Graph Meta Tags if you haven't - the will give Facebook's servers hints as to what content you want to display if it can't be parsed automatically.
Info here: http://davidwalsh.name/facebook-meta-tags

Dynamic OpenGraph Meta Tags will not Parse

I have having trouble getting Facebook to recognize my OpenGraph meta tags for the Social Comments plugin. I have thoroughly researched this matter here and on Google.
I have tried setting content-length header as was suggested in a few other instances of this issue. I have also tried making sure that the fb:comments href was exactly the same as the og:url. None of these are allowing Facebook to recognize my meta tags.
Page Tab URL:
http://www.facebook.com/pages/Telenova-IP-Services/287547201338150?sk=app_348971505174676
URL For Debugger:
http://apps3.ionflo.com/photocontest/index.php?type=restaurant&id=287547201338150-IPUTI8K7EGYMSTBU
FILE /index.php:
97 $cody = array(
98 'title' => $TitleShare,
99 'description' => $DescriptionShare,
100 'type' => 'restaurant');
117 <!-- Open Graph meta tags -->
118 <meta property="fb:app_id" content="348971505174676" />
119 <meta property="og:site_name" content="Test Site Name"/>
120 <meta property="og:url" content="<?php echo $AbsoluteURL; ?>index.php?type= <?php echo $params['type']; ?>&id=<?php echo $PageID . '-' . $CommentRandomVal; ?>"/>
121 <meta property="og:title" content="<?php echo $cody['title']; ?>"/>
122 <meta property="og:description" content="<?php echo $cody['description']; ?>"/>
123 <meta property="og:type" content="<?php echo $cody['type']; ?>"/>
124 <meta property="og:locale" content="<?php echo $params['locale']; ?>"/>
125 <meta property="og:image" content="<?php echo $AbsoluteURL; ?>images/facebook.png"/>
FILE: include/home.php
24 <fb:comments href="<?php echo $AbsoluteURL; ?>index.php?type=<?php echo $params['type']; ?>&id=<?php echo $PageID . '-' . $CommentRandomVal; ?>" num_posts="3000" width="800">
For a full copy of the code, please see:
http //apps3.ionflo.com/photocontest/index.bak
http //apps3.ionflo.com/photocontest/include/home.bak
Please let me know if I am missing any other useful information, I will be glad to update the post.
Cheers,
Cody
URL did not contain correct PageID to pull meta tags.
Solved by ensuring we were passing the PageID correctly into the page as a get variable
E.G. ?PageID=****
Cheers.

Wordpress thumbnail and meta data being ignored when posting to facebook wall

I'm having a problem that I can't seem to figure out, though I'm not sure if I'm on the right track. Can anyone please advise?
I've just created a wordpress website, that post's will be shared on facebook.
I'm using featured images and I would like my featured image facebook thumbnail to be used.
It seems when I post a link to facebook, facebook just picks up images on the page and you can choose a thumbnail.
I'm not really up for that because the images are landscape and don't look good. So I started looking into meta tag with the open graph property to see if I could dynamically populate the content that facebook captures when posting a link to the wall.
This is what I tried...
<meta name="description" content="" />
<meta name="author" content="" />
<meta charset="utf-8" />
<meta property="fb:app_id" content="0000000000000000" />
<?php if ( is_single() || is_page() ) { ?>
<meta property="og:title" content="<?php echo get_the_title(); ?>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="<?php echo get_permalink(); ?>" />
<meta property="og:image" content="<?php $fbthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'facebook-thumb' ); echo $fbthumb[0]; ?>" />
<meta property="og:site_name" content="myblog.co.uk"/>
<meta property="og:description" content="<?php echo get_the_excerpt(); ?>" />
<?php } ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
But all of this is ignored!!!
Can anyone help me understand how to control the content facebook draws in via a link being posted to a wall. I would appreciated your help very much.
Thanks
I had this problem the other day. Facebook wants og:images to be larger than 200px in both directions, or it will ignore them. I found I got the best result when I used wp_get_attachment_image_src($img.ID, 'large')
Have you tried looking at your site with the Facebook Debugger to see what it has to say about your site? https://developers.facebook.com/tools/debug

Facebook Object Debugger

We run a blog in the UK and have recently noticed that Facebook stopped pulling our post descriptions and images when an article is liked, shared etc.
Running the Facebook Object Debugger I get the following messages:
Response Code: 200
Errors That Must Be Fixed
Can't Download: Could not retrieve data from URL.
(In case you wish to see it for yourself, here is a link: https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.heruni.com%2F)
Below is a copy of our code -- what are we doing wrong?
<?php
function is_facebook(){
if(!(stristr($_SERVER["HTTP_USER_AGENT"],'facebook') === FALSE)) {
return true;
}
}
?>
<!DOCTYPE html>
<html dir="ltr" lang="en-US"<?php if(is_facebook()){echo ' xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/"';}?>>
<head>
<title><?php wp_title(''); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="msvalidate.01" content="374D59D3C3F26F6EFC410429D512A98C" />
<?php if(is_facebook()){ ?>
<meta property="og:title" content="<?php single_post_title(''); ?>"/>
<meta property="og:type" content="article"/>
<meta property="og:image" content="<?php echo wp_get_attachment_thumb_url( get_post_thumbnail_id( $post->ID ) ) ?>"/>
<meta property="og:url" content="http://<?php echo $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];?>"/>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>"/>
<meta property="fb:app_id" content="256997234347344"/>
<?php }?>
Check if you use gzip in your page, disable it and try again. That fixed it for me.
This is the markup which Facebook sees for your page:
https://developers.facebook.com/tools/debug/og/echo?q=http%3A%2F%2Fwww.heruni.com%2F
You don't need to do any is_facebook() conditional stuff here - the tags, and the namespace should just be made visible on the web to all HTTP clients, not just the Facebook scraper.
Remove all these conditionals, and you code should work.