I'm creating one facebook application with FBML. What I want is: I have several images like,
<fb:tag name="img">
<fb:tag-attribute name="src">http://My_Img_Url_1.jpg</fb:tag-attribute>
</fb:tag>
<fb:tag name="img">
<fb:tag-attribute name="src">http://My_Img_Url_2.jpg</fb:tag-attribute>
</fb:tag>
While I click on the image it should open one popup "post to wall" or "Post to your Friend's wall" with the corresponding image My_Img_Url_n.jpg.
I can use FBML share button like:
METHOD-1
<fb:share-button class="meta">
<meta name="title" content="Image_TITLE"/>
<meta name="description" content="Image_Descrip"/>
<link rel="image_src" href="http://My_Img_Url_1.jpg"/>
<link rel="target_url" href="Some_Target_URL"/>
</fb:share-button>
OR,
METHOD-2: I can call fb:ui
<script>
FB.init({
appId:'111111111111111', cookie:true,
status:true, xfbml:true
});
FB.ui({ method: 'feed',
name: '',
link: '',
picture: 'http://My_Img_Url_1.jpg'
});
</script>
Now the questions are:
- If I click on any image it will call either METHOD-1 or METHOD-2 and it will popup with that image. How can I do that?
- If I use
<fb:multi-friend-input />
for posting to friend's wall, How can I do?
I would go with option 2 as FBML is going to be deprecated soon (https://developers.facebook.com/docs/reference/fbml/).
To sum up, initialize the JS SDK, make sure that your user is logged in and then wrap the FB.ui call with a new function. Then write out your images to the page in HTML and assign the click event to call your new Javascript function.
This example will post to the users wall. If you want to post to another users wall, you'll first need to grab the current users friends IDs with FB.api('me/friends', myGreatCallback) (see https://developers.facebook.com/docs/reference/javascript/FB.api/) and then pass this into postToWall()
I wrote this without trying to run it, let me know if you run into any any errors ;). You can find more information on the Facebook JS SDK at: https://developers.facebook.com/docs/reference/javascript/