O'Reilly logo

Facebook Application Development with Graph API Cookbook by Apeksha Singh, Shashwat Srivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Posting a picture to a specific album of the user

Using Facebook Graph API, we can programmatically post a picture to any album of the user. We can use this to create images and post them on behalf of the user.

Getting ready

You should have the album ID to which you want to post the picture. Additionally, you must have created config.php and index.php as explained in the beginning of this chapter. Also, the application needs to have the publish_stream permission for posting the picture.

How to do it...

We can upload a picture to an album by following these steps:

  1. Create a new file and name it as action_postpic.php. Add the code given below to this file:
    <?php
  2. Include the configuration file:
      require_once 'config.php';
  3. Use the realpath() function to return ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required