Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 1.12 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Upload Graph API Dinamic url
  2. <?php
  3. $images = array(
  4.         0 => 'imagine1.jpeg',
  5.         1 => 'imagine2.jpeg',
  6.     );
  7.     $image = $images[ rand(0,(count($images)-1)) ];
  8.     $output = "<img src="images/".$image."" alt="" border="0" />";
  9.     print($output);
  10. ?>
  11.  
  12. <?php
  13. //At the time of writing it is necessary to enable upload support in the Facebook SDK, you do this with the line:
  14. $facebook->setFileUploadSupport(true);
  15.  
  16. //Create an album
  17. $album_details = array(
  18.         'message'=> 'Album desc',
  19.         'name'=> 'Album name'
  20. );
  21. $create_album = $facebook->api('/me/albums', 'post', $album_details);
  22.  
  23. //Get album ID of the album you've just created
  24. $album_uid = $create_album['id'];
  25.  
  26. //Upload a photo to album of ID...
  27. $photo_details = array(
  28.     'message'=> 'Photo message'
  29. );
  30. $file='http://worldofgothic.ro/app/images/'.$image;
  31.  
  32. //Example image file
  33. $photo_details['image'] = '@' . realpath($file);
  34.  
  35.  
  36. $upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
  37.  
  38. ?>
  39.        
  40. $file='http://worldofgothic.ro/app/images/'.$image;
  41.  
  42.     //Example image file
  43.     $photo_details['image'] = '@' . realpath($file);