I'm trying to share a dynamic content to Facebook and below is my code, everything works fine but the image is not taking, no idea what is the issue is. Below is my code
FB.ui({
method: 'feed',
link: fb_share_url,
picture: picture,
quote: title,
});
For fetching images i prefer Piccaso Open source library
Related
I tried to use FB.ui and share method to share dynamic gif.
The image was hosted in my own server. After shared, I found it was in static image.
Is it possible to host the gif other than GIPHY.com and some related images hosting websites? Any settings than need to be configured in my server?
I have tried to add mime type and add same value for og:url and og:image in html head section. But all of them failed.
Any advise? Thanks.
The code is as simple as the followings.
$('.test').click(function(){
FB.ui({
method: 'share',
link: 'http://MY DOMAIN/img/THE GIF.gif',
caption: 'An example caption',
href: 'http://MY DOMAIN/img/THE GIF.gif',
}, function(response){});
});
I can post a photo IF I had the time to get an app approved. I can share a link that pulls in a photo from THAT page. The goal is to post a link that goes to X, but the image is hosted somewhere else.
Is this possible?
Yes, it's possible by using the JavaScript SDK and the Share Dialog. For example, I can do the following, which shares a link but with a custom image, name and caption. It basically overwrites all the OG data on my page.
function fb_share() {
FB.ui( {
method: 'feed',
name: "Facebook API: Tracking Shares using the JavaScript SDK",
link: "https://www.webniraj.com/2013/05/11/facebook-api-tracking-shares-using-the-javascript-sdk/",
picture: "https://stackexchange.com/users/flair/557969.png",
caption: "Tracking Facebook Shares on your website or application is a useful way of seeing how popular your articles are with your readers. In order to tracking Shares, you must used the Facebook JavaScript SDK."
}, function( response ) {
// do nothing
} );
}
$(document).ready(function(){
$('button.share-btn').on( 'click', fb_share );
});
You can do the same thing in PHP if you have the publish_actions permission approved by Facebook. Both would produce the following result:
Source
I have a facebook app that uses the feed dialog:
FB.ui({
method: 'feed',
message: '',
link: 'http://mywebaddress/pathToContent',
picture: 'http://mywebaddress/pathToPhoto/photo.jpg',
display: 'popup'
});
When I used the app to share content, I forgot to upload the image so the share dialog appeared with the image broken. Now I uploaded the image but it no way I can get it to show up.
1) Tried to use the debugger and it shows in the og:image correct but of course the feed dialog is different from the og tags so it is of no use in this case.
2) It works well from other accounts. Only mine is broken because I tried to share without uploading the image.
3) Tried in different browsers and tried to clear cookies,cache,etc...
4) It works if I rename the file
Do you know a way to force clear the facebook cache or it should go by time or what?
Thanks
I've been dealing with a similar issue with Facebook cache. You can try using
curl -v https://developers.facebook.com/tools/lint/?url=YOUR_URL_HERE&format=json
In console window. That didn't work in my case but I was trying it on a web page not an app so you might have better luck. Hope it helps.
Here's my FB.ui code:
FB.ui({
method: 'feed',
message: '',
link: 'http://mywebaddress/pathToContent',
picture: 'http://mywebaddress/pathToPhoto/photo.jpg',
display: 'popup'
});
The dialog pops up perfectly, it has the link so no problem... but the picture doesn't show.
I have verified the picture URL is correct. Then I have used the Debugger to test the content URL's open graph tags: it runs flawlessly.
Apparently, the debugger clears some sort of caching. After I use the debugger on the link, the FB.ui dialog shows the picture just fine.
Is there something I can do about this? The content that users are sharing from my site to Facebook isn't showing the picture like it should, making it a bit annoying for them to use (which is never a good thing!)
Thanks!
You need to change the og:image in the source of the shared url instead. The picture parameter is deprecated: https://developers.facebook.com/docs/sharing/reference/feed-dialog/#response
The problem is that you didn't set the URL of your image.
Since you're using a relative URL, the FB.ui is looking for the image in the same folder as the current page. What you should do is put the full URL of your image.
<code>picture: 'http://mywebaddress/pathToPhoto/photo.jpg',</code>
If you don't have the full URL of your image, you can use the following code to get the full URL:
<code>var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
url = url.substring(0, url.lastIndexOf('/') + 1);
url += 'pathToPhoto/photo.jpg';
</code>
I want to create a post to a user's wall via my facebook connect mobile app. I looked on the FB developer's website and only found this to post through mobile:
http://www.facebook.com/dialog/feed?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&display=touch
along with this statement The current version of the JavaScript SDK does not yet supporting automatically selecting the correct dialog for the user's device. We expect to add this capability shortly.
Has this been fixed yet? I have been trying to workaround using the normal method:
//Post on user's wall
FB.ui(
{
method: 'feed',
name: 'MyApp',
link: 'myURL',
picture: 'http://fbrell.com/f8.jpg',
caption: caption,
description: message,
message: ''
},
function (response) {
});
But it is slow and doesn't work the way I want it to.
Suggestions?
As of now no the cannot. You can still do auto publish posts though.