3

I'm creating a small app in which people compare diferent pictures of him and his friends.

The app is verry simple and I have no problem with it. The problem comes when users try to publish in their walls. I want the posts to be something like:

enter image description here

I know that by doing something like:

$parameters = array('message' => 'this is my message',
                    'name' => 'Name of the app',
                    'caption' => "Caption of the Post",
                    'link' => 'http://www.link.com',
                    'description' => 'description',
                    'picture' => 'http://mysite.com/pic.gif');

$result = $facebook->api('/user_id/feed/', 'post', $parameters );

You can post on a wall, but that limits the app to one picture only and I want the users to be able to post two diferent picures.

Is there a way to publish a post like the one in the image?


EDIT:

Added a picture that might explain what I want in a better way.

enter image description here

Sparky
  • 98,165
  • 25
  • 199
  • 285
J-Rou
  • 2,216
  • 8
  • 32
  • 39

3 Answers3

4

Without getting too deep into the Facebook API (since I've never seen a FB app post two photos, I'm guessing it's not possible - most of the apps I see would be as spammy as allowed...), I'd probably start by just compositing the two images (and doing any overlays I wanted to do) at the server side dynamically using something like PHP and the ImageMagick classes.

Then, just feed Facebook the URL to the PHP script that does the compositing, e.g.

$parameters = array('message' => 'this is my message',
                    'name' => 'Name of the app',
                    'caption' => "Caption of the Post",
                    'link' => 'http://www.link.com',
                    'description' => 'description',
                    'picture' => 'http://mysite.com/pic.php?pic1_id=1234&pic2_id=2345&favorite=pic1');

$result = $facebook->api('/user_id/feed/', 'post', $parameters );

Of course, I don't know what sort of dimensions Facebook will take for a picture to be posted with a wall post - it might not be wide enough for this to work. I'd try it, though...

ETWW-Dave
  • 732
  • 5
  • 8
  • I had already thought about that, but I have never seen a picture that long on a facebook post. Anyway, I'll need a class to add the selected picture message under the picture to the selected picture so I'll need the ImageMagic class anyway. – J-Rou Jun 23 '11 at 19:48
2

Facebook did away with multiple pictures in a post a while ago. When you were able to do it, people were creating "banners" that consisted of multiple pictures side by side. Now only 1 pictured is displayed for any wall post. You can post more pictures, but they won't be sure by default. Facebook will add a "more" link, although they may have done away with that also.

Brent Baisley
  • 12,641
  • 2
  • 26
  • 39
1

At least in Javascript when using Facebook.streamPublish, as second argument you can give an attachment object that may contain an array of media. Here are the relevant pieces from my app Japan Name:

var media = [];
for (var i = 1; i < syls.length; i++) {
    media.push({
        'type' : 'image',
        'src' : 'http://youarecu.appspot.com/chars/' + syls[i] + '.png',
        'href' : streamhref
    });
}

...

var attachment = {
    'href':'http://apps.facebook.com/youarecute/?from_wall=true&postid=f'+uid+'{{postid}}',
    'name':linkedtxt,
    'description':txt,
    'media':media
};

...

Facebook.streamPublish("", attachment, ...
Bemmu
  • 17,849
  • 16
  • 76
  • 93