1

Hellow guys am new to facebook app development.I am trying to develop an application which generates an images when a user gives the app a permission to his/her profile.I have serached many times but i didnt get any useful information.

I have came across gd library too but i didnt get how to use gd library in generating images with facebook statistics like no of messages,profile pic images etc .

I have seen a lot of apps like this ..I can show you what i mean .Just look the link below to see the image ..

http://s30.postimg.org/a37uy9qzl/554327_429089617163509_20686672_n.jpg

and yeah this is the same thing i want to do .i want to make an app which generates a background image and in that background image i want to add some text and display the profile picture who use the app and the other is the any person from the friend list

<?php
require'facebook.php';

   $app_id = "606714542734115";
   $app_secret = "3501a1caf56a888b02d8f2d7301337ec";
   $post_login_url = "https://apps.facebook.com/bestfriendzzz
   $album_name = 'BEST FRIENDS';
   $album_description = 'A COOL APPLICATION FOR FINDING YOUR BEST FRIEND';

  $attachment= array('message' => "message",
        'name' => 'name',
        'caption' => "caption",
        'link' => 'some URL address',
        'picture' => {
   "error": {
      "message": "(#803) Some of the aliases you requested do not exist: PROFILE_ID_NUMBER",
  "type": "OAuthException",
  "code": 803
   }

});


        $headers = get_headers("https://graph.facebook.com/$fbid/picture?type=large");
$image_loc = $headers[5];
?>

This is just a code sample that i have done .I am stuck with this .Please guide me how to do this.Code samples are appreciated and thanks in advance .:)

user3220407
  • 41
  • 1
  • 5

2 Answers2

0

it's acutally easier to use php gd library to upload image on facebook

$fileUpload = true; // just add this code

check out my app it uploads an image tofacebook whenever a user allows direct access (anime meme generator)

here's an example of image that is uploaded to facebook http://www.acnologia.com/staticimage.php?m=7046814 it does not necessarily need to have a .jpg or .png extension i use php gd library on this one

$photo = "http://www.acnologia.com/staticimage.php?m=7046814"; //this is the code that uploads the image on facebook

in your case change your code into this

'picture' => $photo

hope this helps

Madara
  • 22
  • 6
  • have you made an app like this ?..yeah i know i just want to create an imag using gd library .then how can i make the profile picture of the user and a friends profile pic to that backgound image ? – user3220407 Jan 25 '14 at 14:52
  • i havnt found your app ?..can you give me the link to ur app ? – user3220407 Jan 25 '14 at 14:54
  • to get the profile picture you need FQL to do that and to blend them in one image you need a new code for php GD to do that – Madara Jan 25 '14 at 15:29
  • jean can you give me a link to that code .am really confused .i have written a code for creating and editing the text on the image using gd now i want to fetch the user profile pic and a random profile pic of his friend to display to that image ... – user3220407 Jan 25 '14 at 15:36
  • Thanks jean ...a link is enough ..:) – user3220407 Jan 25 '14 at 15:40
0

first here's a code that will upload an image to facebook

include 'facebook/libs/facebook.php';
$config = array();
$config['appId'] = 'yourappid';
$config['secret'] = 'yourappimage';
$config['fileUpload'] = true;

$facebook = new Facebook($config);
$user_id = $facebook -> getUser();
$photo = "http://www.acnologia.com/staticimage.php?m=7090032"; // url of the image generated using php gd library
$message = "hola mundo";

if ($user_id) 
{



$upload_photo = $facebook->api('/me/photos', 'POST', array(
                                     'url' =>  $photo,
                                     'message' => $message,
                                     )
                                  );    





}

$config['fileUpload'] = true; //this line here is what you lack in your code that's why it doesn't upload

Madara
  • 22
  • 6
  • here's a link on how to merge to images using php gd library http://stackoverflow.com/questions/3876299/merging-two-images-with-php it works for me – Madara Jan 25 '14 at 15:53
  • thanks man ...and what is $photo here ? ..the link of my image ? – user3220407 Jan 25 '14 at 15:55
  • yeah the link of your image...http://www.acnologia.com/staticimage.php?m=7090032 my image is created via php gd library that's why the extension is .php instead of .jpg or .png but facebook still uploads them – Madara Jan 25 '14 at 15:59
  • yeah thats cool ..and i have added the above code as index.php and i have added http://pastebin.com/nHc00aNN as image.php .Then whats the step i want to do ?..is the 2 files enough and the facebook.php from sdk .is these files enough for my project dear jean ? – user3220407 Jan 25 '14 at 16:05
  • yes two files is well enough...you also need to learn fql to get the profile picture and put it here $im = imagecreatefromjpeg('linkofprofilepicture'); – Madara Jan 25 '14 at 16:11
  • i didnt get that ?..link of the profile picture means ?.using fql is it like query ? – user3220407 Jan 25 '14 at 16:16
  • so for executing do i need to create a new database or just execute it on graph api explorer ? – user3220407 Jan 25 '14 at 16:17
  • you dont need to create new database...images will be stored on facebook anyway unless...you want a copy for your app – Madara Jan 25 '14 at 16:23
  • what i want to do next from the fbl query i have these codes in 2 files ..i just want to understand that fbl query $im=imagecreatefromjepg(link of prfle pictr) ..what is link of prfl pictr here ? – user3220407 Jan 25 '14 at 16:45