Facebook Wall Post Picture relative URL PhoneGap - facebook

I would like to post to facebook wall with a local picture in a Phone Gap Project.
Here is the code.
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
redirect_uri: 'YOUR URL HERE',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
In the line:
picture: 'http://fbrell.com/f8.jpg',
I tried to change it into a relative url like:
picture: '../blabla.png',
and I continue getting the error of API ERROR Code 100, Picture URL is not correctly formatted. I checked the facebook api and it is not clearly stated there. It says:
The URL of a picture attached to this post. The picture must be at least 50px by 50px (though minimum 200px by 200px is preferred) and have a maximum aspect ratio of 3:1
Can anybody help me with this? Thanks.

iirc, the picture need to be accessible on the internet. Thus, you cannot use local images. – wmfairuz
The image url must be an Absolute URL – Tommy Crush
Problem solved.

Related

How to share individual images in facebook

I would like to enable users to share a certain feed with dynamically generated pictures. This means that the picture url is always a new one.
However, it seems that the picture Facebook is using is not that from the URL but always (an old) one from the cache.
The URL is something like http://www.domain.com/facebook/unique-picture.png
How is it possible to turn off the caching?
function shareMessage(link) {
alert(link);
FB.ui(
{
method: 'feed',
name: link,
link: 'link',
picture: link,
caption: link,
description: "description",
message: ''
});
}

Facebook API Why image not upload in post?

FB.ui({
method: 'feed',
caption: 'test: '+ Link,
description: '',
to: *******,
picture: 'https://SITE.com/UserGifts/ImageMail/1402530327.jpg',
link: Link,
redirect_uri: Link,
}, function(response){});
When code is start we see
Tell me please why image not upload with post?
P.S.: Image exist on server, console not have error.
Change
https://example.com/UserGifts/ImageMail/1402530327.jpg
on
http://example.com/UserGifts/ImageMail/1402530327.jpg
Where example is name your site(SITE)
P.S.: not use https on url image, use only http.

Facebook dialog post with embedded swf showing only sometimes

I'm trying to do a basic facebook wall post with an embedded flash object based on the following documentation:
https://developers.facebook.com/docs/reference/dialogs/feed/
I'd like to do this using just a direct URL, like (note parameters get encoded):
https://www.facebook.com/dialog/feed?
app_id=SOME_APP_ID&
link=http://www.myregisteredfbdomain.com/someurl&
picture=http://www.myregisteredfbdomain.com/cfg/media/imagelink.png&
name=Flash%20Test&
caption=Just%20a%20test&
description=A%20Description&
redirect_uri=http://www.myregisteredfbdomain.com/someurl&
source=http://www.myregisteredfbdomain.com/facebook/aflashfile.swf
Although I've also tried it using javascript, with the same result:
<script>
FB.init({appId: SOME_APP_ID, status: true, cookie: true});
function postToFeed() {
var obj = {
method: 'feed',
redirect_uri: 'http://www.myregisteredfbdomain.com/someurl',
link: 'http://www.myregisteredfbdomain.com/someurl',
picture: 'http://www.myregisteredfbdomain.com/cfg/media/imagelink.png',
name: 'Flash Test',
description: 'A Description',
source: 'http://www.myregisteredfbdomain.com/facebook/aflashfile.swf'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
When I do the post under my development fb account, the post shows up fine, and I can click on the icon which displays the flash correctly.
However when I post under my own personal fb account, the post shows with the image only, but no flash activation when I click it - it just goes to the link/redirect link I defined.
Can anyone give me any pointers as to why this might be the case?
Found out why - It's because I'm accessing the post to my personal account through a https connection, which doesn't show the flash - it's linked via a http connection.

Friendly URl on Facebook Share

I am working on Facebook Share for my website and basically it is working fine but just a little wrinkle there. Whenever user does a share on Facebook, it share the URL on his/her wall. But I would like to add some description into it like all the News papers do it.CNN and NYTimes. When a user shares something, URL will go on the wall but there would be title of the article or something that is in a bigger fonts and is able to draw people's attention.
How can I do that?
You have to use Facebook API to create Dialogs and post to User Feed,
a direct URL example:
https://www.facebook.com/dialog/feed?
app_id=APP_ID&
link=https://YOUR_DOMAIN&
picture=http://YOUR_DOMAIN/image.jpg&
name=Facebook%20Dialogs&
caption=API%20Dialogs&
description=Using%20Dialogs%20to%20interact%20with%20users.&
redirect_uri=http://YOUR_DOMAIN/response
a Javascript example:
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
alert("Post ID: " + response['post_id']);
}
FB.ui(obj, callback);
}
Documentation: https://developers.facebook.com/docs/reference/dialogs/feed/

Add additional actions when clicking onFacebook Share button

Is it possible to add an additional action (for example - alert("Thank you for share")) after user has clicked on share button on my web page.
I've found some solution here: http://developers.facebook.com/docs/reference/dialogs/feed/
But if I use this, at the bottom wrote: via + NAME OF APPLICATION
Can I do it without this text at the bottom?
Thank you!
The "via + NAME OF APPLICATION" is something that can not be changed. The user needs to know that this post originated from that application. You can not remove it...
With regard to a callback - you can use it like this :
// calling the API ...
var obj = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
FB.ui(obj, function(){
// Here you can put your code to be executed after the user publishes his/her post.
});