Custom image for facebook link sharer - facebook

Using graph API, I can set a custom image to be displayed when sharing link from my app. But, when a user shares a link of my website manually, a random image of my website comes in rather than my logo. So, is there a meta tag or something using which I can set a custom image as the image to be displayed in the link description box of facebook? Thanks in advance...

What you want to add are the Open Graph tags so that Facebook can parse your website more easily than its default parsing. The <meta> tags required are
<meta property="og:title" content="Page's Title" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://yourwebsite/article" />
<meta property="og:image" content="http://yourwebsite/images/displayImage.jpg" />

Thank you Anvesh. I applied your suggestion, but in my case it is not working, as it should.
If I post my link page to the wall, it's ok, the image is showing. But if I post via url share/sharer.php, image is hidden, except on some web image host like imagilive.com (weird).
But, anyway, after posting the page url in the facebook debugger, all I did which failed before, is done with success.
I can handle the issue this way, but I have to do it with every page. Just imagine you have a photo gallery with each image shareable.
I need a better solution or a fix.

Related

sharing a link on facebook displays the wrong image

i'm facing a problem with sharing links on facebook which is displaying the wrong image many times and just sometimes it displays the correct image using the code like this
<meta property="og:title" content="webpage title" />
<meta property="og:url" content="http://www.domain.com/webpage_url.php?id=17515278817738945084phb">
<meta property="fb:app_id" content="app id here"/>
<meta property="og:type" content="website" />
<meta property="og:image" content="http://www.domain.com/large/image.jpg" />
and when debugging the page i get this
The 'og:type' property is required, but not present.
this image is 1000*317px and still not showing up. this happens with all the links of my site. I have to go to url debugger and clear the cache so facebook can get the correct image. so how to fix this problem and make facebook display the correct image directly?
[UPDATE]
using the facebook debugger i get this notice
og:image was not defined, could not be downloaded or was not big enough. Please define a
chosen image using the og:image metatag, and use an image that's at least 200x200px and
is accessible from Facebook. Image 'http://www.domain.com/gallery1/01234.jpg' will
be used instead.
But the og:image is set properly and image size is largr than 200*200 and Facebook displays the correct image after clearing the Facebook cache though it keeps displaying this notice
Try pointing to your index file. eg www.yourdomain.com/index.php when using the facebook object debugger. It fixed the og:name error for me.

Using Open Graph for Facebook link sharing

I've set up some OG meta data on my site so that when sharing a link, it displays a nice logo which I have created specifically for Facebook (it's square on a nice coloured background so it looks good on the site.)
However with this in place I am now no longer able to choose any other image. I was hoping for the logo to be the default but for the link sharing to still allow me to scroll through thumbnails from the page. Now it just gives me the option for the logo and nothing else.
Is it possible to set both a specific og:image and still have access to the thumbnails functionality on Facebook?
Here is my metadata:
<meta property="og:image" content="http://www.mysitehere.com/images/oglogo2.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="500" />
<meta property="og:image:height" content="500" />
You find your answer here:
How does Facebook Sharer select Images and other metadata when sharing my URL?
Quote: "You just need to add multiple image meta tags in the order you want them to appear in. The user will then be presented with an image selector dialog."

The image to show when a web page is shared in facebook

I've a web page and I want to share it in facebook but the image shown is not ok.
In the HTML code of the web I have:
<link href="http://www.example.com/img/logo2.png" rel="image_src" />
In the options to select the image, there are other images, but not logo2.png
I've tried to delete facebook cache with facebook debugger, but the result is the same.
Edit:
If I add ?v=1 to the end the URL when I share it, the logo option is shown. It means that facebook debugger is not deleting the cache.
Also, I want that the logo image be the first option.
Can you help me?
Solved:
<!-- facebook tags -->
<meta property="og:image" content="http://www.example.com/img/logo.png"/>
<meta property="og:url" content="http://example.com">
<meta property="og:title" content="Portfolio | web">
<meta property="og:description" content="Portfolio">
I think that you may be using the wrong tag. I haven't done this in a while, but I believe that it should be a <meta tag with a property="og:image" and then content set to your image. The following (really old) question addresses this issue/conforms to what I remember: How does Facebook Sharer select Images and other metadata when sharing my URL?
Let me know if it works :)

Change thumbnail on Facebook link

When I link to my website on Facebook a thumbnail comes up but it is not the thumbnail I want to come up. How do I change the thumbnail. It shows the image on the object debugger
http://developers.facebook.com/tools/debug/og/object?q=totelfootball.com
How do I change the image?
I have seen similar posts but want to no a simple solution for the issue? Can it be done on Facebook no coding involved?
you can add into <head></head>
this tag <link rel="image_src" href="http://URL-TO-YOUR-IMAGE" / >
OR change <html> tag to
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
and add into tag <head></head>
this tag
<meta property="og:image" content="http://URL-TO-YOUR-IMAGE" />
Don`t forget to test your link using facebook debug tool
Go to http://developers.facebook.com/tools/debug
Enter the URL following by fbrefresh=CAN_BE_ANYTHING
Examples:
http://www.example.com?fbrefresh=CAN_BE_ANYTHING
http://www.example.com?postid=1234&fbrefresh=CAN_BE_ANYTHING
OR visit:
http://developers.facebook.com/tools/debug/og/object?q=http://www.example.com/?p=3568&fbrefresh=89127348912
I was having the same issue last night, and I got this solution from some website.
Facebook saves your cache thumbnail. The thumbnail will not change even if you delete the image from your server. But Facebook allows you to refresh by using fbrefresh
I hope this helps.
You can choose what thumbnail is displayed by adding an og:image meta tag to the HTML of totelfootball.com:
https://developers.facebook.com/docs/opengraph/
Facebook uses meta tags on the page you're sharing to determine which image, title, and description to show when posting a link. The meta tag syntax follows Facebook's OpenGraph specification.
The most important meta tags you need to define are:
<meta property="og:title" content="The title of the sharing preview" />
<meta property="og:description" content="The first few lines of content below the title" />
<meta property="og:image" content="http://example.com/your-image-1200x630px.jpg" />
This of course only works if you have complete control over the site you’re sharing. If you’re sharing an external link (like a news article), you don’t have access to their site and therefore can’t change the meta tags. I'm using ShareKit.io, which allows you to change the title, description, and image of any link you’re sharing without having to fiddle with meta tags.
Easier than this.
Go to the link you shared. Open it in a new tab.
Right upper corner --> Refresh Share Attachment
New thumbnail image gets fetched and you get an option to choose another.
Hope this helps :)

Auto Update image of a shared link on fan wall [duplicate]

When using Facebook Sharer, Facebook will offer the user the option of using 1 of a few images pulled from the source as a preview for their link. How are these images selected, and how can I ensure that any particular image on my page is always included in this list?
How do I tell Facebook which image to use when my page gets shared?
Facebook has a set of open-graph meta tags that it looks at to decide which image to show.
The keys one for the Facebook image are:
<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
<meta property="og:image:secure_url" content="https://secure.example.com/ogp.jpg" />
and it should be present inside the <head></head> tag at the top of your page.
If these tags are not present, it will look for their older method of specifying an image: <link rel="image_src" href="/myimage.jpg"/>. If neither are present, Facebook will look at the content of your page and choose images from your page that meet its share image criteria: Image must be at least 200px by 200px, have a maximum aspect ratio of 3:1, and in PNG, JPEG or GIF format.
Can I specify multiple images to allow the user to select an image?
Yes, you just need to add multiple image meta tags in the order you want them to appear in. The user will then be presented with an image selector dialog:
I specified the appropriate image meta tags. Why isn't Facebook accepting the changes?
Once a url has been shared, Facebook's crawler, which has a user agent of facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php), will access your page and cache the meta information. To force Facebook servers to clear the cache, use the Facebook Url Debugger / Linter Tool that they launched in June 2010 to refresh the cache and troubleshoot any meta tag issues on your page.
Also, the images on the page must be publicly accessible to the Facebook crawler. You should specify absolute url's like http://example.com/yourimage.jpg instead of just /yourimage.jpg.
Can I update these meta tags with client side code like Javascript or jQuery?
No. Much like search engine crawlers, the Facebook scraper does not execute scripts so whatever meta tags are present when the page is downloaded are the meta tags that are used for image selection.
Adding these tags causes my page to no longer validate. How can I fix this?
You can add the necessary Facebook namespaces to your tag and your page should then pass validation:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="https://www.facebook.com/2008/fbml">
When you share for Facebook, you have to add in your html into the head section next meta tags:
<meta property="og:title" content="title" />
<meta property="og:description" content="description" />
<meta property="og:image" content="thumbnail_image" />
And that's it!
Add the button as you should according to what FB tells you.
All the info you need is in www.facebook.com/share/
As of 2013, if you're using facebook.com/sharer.php (PHP) you can simply make any button/link like:
<a class="btn" target="_blank" href="http://www.facebook.com/sharer.php?s=100&p[title]=<?php echo urlencode(YOUR_TITLE);?>&p[summary]=<?php echo urlencode(YOUR_PAGE_DESCRIPTION) ?>&p[url]=<?php echo urlencode(YOUR_PAGE_URL); ?>&p[images][0]=<?php echo urlencode(YOUR_LINK_THUMBNAIL); ?>">share on facebook</a>
Link query parameters:
p[title] = Define a page title
p[summary] = An URL description, most likely describing the contents of the page
p[url] = The absolute URL for the page you're sharing
p[images][0] = The URL of the thumbnail image to be used as post thumbnail on facebook
It's plain simple: you do not need any js or other settings. Is just an HTML raw link.
Style the A tag in any way you want to.
From my experience, the http://www.facebook.com/sharer.php does not use meta tags. It uses the string you pass. See below.
http://www.facebook.com/sharer.php?s=100&p[title]=THIS IS MY TITLE&p[summary]=THIS IS MY SUMMARY&p[url]=http://www.MYURL.com&&p[images][0]=http://www.MYURL.com/img/IMAGEADDRESS
The meta tags work with Facebook's developer like/send buttons, as does the other Open Graph info. So if you use one of Facebook's actual elements like the comments and such, that will all tie into the Open Graph stuff.
UPDATE: There are two ways to use the sharer * note the ?s versus the ?u value in the query string
1 ==> STRING: http://www.facebook.com/sharer.php?s + content from above
~~> Will pull info from the string.
2 ==> URL: http://www.facebook.com/sharer.php?u=url where url equals an actual url
~~> Will scrape the page provided in the url value
~~> You can test test the values here: https://developers.facebook.com/tools/debug
Put the following tag in the head:
<link rel="image_src" href="/path/to/your/image"/>
From http://www.facebook.com/share_partners.php
As far as what it chooses as the default in the absence of this tag, I'm not sure.
Old way, no longer works:
<link rel="image_src" href="http://yoururl/yourimage"/>
Reported new way, also does not work:
<meta property="og:image" content="http://yoururl/yourimage"/>
It randomly worked off and on during the first day I implemented it, hasn't worked at all since.
The Facebook linter page, a utility that inspects your page, reports that everything is correct and does display the thumbnail I selected... just that the share.php page itself doesn't seem to be functioning. Has to be a bug over at Facebook, one they apparently don't care to fix as every bug report regarding this issue I've seen in their system all say resolved or fixed.
To change Title, Description and Image, we need to add some meta tags under head tag.
STEP 1 :
Add meta tags under head tag
<html>
<head>
<meta property="og:url" content="http://www.test.com/" />
<meta property="og:image" content="http://www.test.com/img/fb-logo.png" />
<meta property="og:title" content="Prepaid Phone Cards, low rates for International calls with Lucky Prepay" />
<meta property="og:description" content="Cheap prepaid Phone Cards. Low rates for international calls anywhere in the world." />
NEXT STEP :
Click on below link
https://developers.facebook.com/tools/debug
Add your URL in text box (e.g http://www.test.com/) where you mentioned the tags.
Click on DEBUG button.
Its done.
You can verify here https://www.facebook.com/sharer/sharer.php?u=http://www.test.com/
In above url, u = your website link
ENJOY !!!!
For secure HTTPS
<meta property="og:image:secure_url" content="https://image.path.png" />
Use facebook feed dialog instead of share dialog to show custom Images
Example:
https://www.facebook.com/dialog/feed?app_id=1389892087910588
&redirect_uri=https://scotch.io
&link=https://scotch.io
&picture=http://placekitten.com/500/500
&caption=This%20is%20the%20caption
&description=This%20is%20the%20description
I had this problem and fixed it with manuel-84's suggestion. Using a 400x400px image worked great, while my smaller image never showed up in the sharer.
Note that Facebook recommends a minimum 200px square image as the og:image tag: https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content/#tags
This is what worked for me: I placed the desired thumbnail image on the page right after the tag and making it too small to see..
<img src="imagename.jpg" width="1" height="1" />
I have not tested it with height 0 and width 0 but it probably will still work.. This does not guarantee the user will select this image..
ALSO it seems like Facebook caches the thumbnails on your page and doesnt always check it for new ones.. try adding this to another page on your site and you'll see that it works.
I couldn't get Facebook to pick the right image from a specific post, so I did what's outlined on this page:
https://webapps.stackexchange.com/questions/18468/adding-meta-tags-to-individual-blogger-posts
In other words, something like this:
<b:if cond='data:blog.url == "http://urlofyourpost.com"'>
<meta content='http://urlofyourimage.png' property='og:image'/>
</b:if>
Basically, you're going to hard code an if statement into your site's HTML to get it to change the meta content for whatever you've changed for that one post. It's a messy solution, but it works.