Add picture on facebook wall using php

November 1, 2009
Filed under: FaceBook Integration, Featured, PHP 

First Follow the 5 Steps from my Previous post http://blog.theunical.com/facebook-integration/5-steps-to-publish-on-a-facebook-wall-using-php/ then in last program include the below code to publish a photo and also meta data on a facebook wall.

Publishing a Post Containing an Image, Action Links and Custom Metadata


$message = 'Check out this cute pic.';

$attachment = array( 'name' => 'i\'m bursting with joy',
'href' => 'http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/',
 'caption' => '{*actor*} rated the lolcat 5 stars', 'description'
 => 'a funny looking cat', 'properties' => array('category'
 => array( 'text' => 'humor', 'href' =>
'http://www.icanhascheezburger.com/category/humor'), 'ratings' => '5 stars'),
 'media' => array(array('type' => 'image', 'src' =>
 'http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg',
 'href' => 'http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/')),  'latitude' => '41.4',
 //Let's add some custom metadata in the form of key/value pairs 'longitude' => '2.19');
$action_links = array( array('text' => 'Recaption this',
 'href' => 'http://mine.icanhascheezburger.com/default.aspx?tiid=1192742&recap=1#step2'));
 $facebook->api_client->stream_publish($message, $attachment, $action_links);

Exiting isn’t it.

–Steven

Similar Posts

Comments

7 Comments on Add picture on facebook wall using php

  1. Arun on Mon, 1st Feb 2010 9:01 am
  2. hi, I am following this code, and the stream is published on the facebook waal. Bu the thumbnail of the image is not coming. Am used the above code and the “src” in the attachemnt link only change, But the thumb is not coming..

  3. Steven Robert on Mon, 1st Feb 2010 10:43 pm
  4. Arun, Is the Image a public URL.
    if its a local URL then it will not work.
    try with some public URL.

  5. Arun on Thu, 25th Feb 2010 2:33 am
  6. Hi,
    One question , i am posting 3 pictures to the wall, sometimes only one picture is loaded in to the wall and there is coming the “cross” image is coming for the next two images. But when checking after 20-30 min all the 3 images are loaded in the wall. When i check the source of this html code, i found the image thumbs are there, but the images are not loaded in facebook. what is the reason behind this? Why facebook not loaded all the pictures instantly. I am using your code but not submit a description for the images.

  7. Steven Robert on Fri, 26th Feb 2010 12:18 am
  8. Hi Arun, can you give your wall link

  9. Arun on Fri, 26th Feb 2010 5:25 am
  10. http://www.facebook.com/profile.php?id=100000510250944

    Here is the link to my wall. there was a posting with title “Pickle Pond” . No images are loaded

  11. Arun on Fri, 26th Feb 2010 5:33 am
  12. please look the source of the images in the wall, the thumbs are there but not loaded…

  13. D on Fri, 26th Feb 2010 5:42 am
  14. Guys,
    my image in not visible on wall. any reason
    I m using above posted script with publish URL in image src.

    Thanks,
    D

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!