TIMELINE : photo upload to an album

217 views
Skip to first unread message

Aditya Gada

unread,
Oct 23, 2012, 2:43:03 AM10/23/12
to fb_g...@googlegroups.com
All photos uploaded from the rails app go to albums but are not shown on timeline.
I need every photo or album uploaded from rails app to be shown in TIMELINE of the PAGE.
Any help will be appreciated!

# fb code
      @me = FbGraph::User.me(session[:fb_access_token])

      @page = @me.accounts.detect do |p|
        p.name == 'Fast cars'
      end
#=end

#=begin # fb page create new album
      @page.album!( 
        :name => 'new', 
        :message => 'new the_message', 
        :description => 'new the_description' 
      ) 
#=end

#=begin # fb album uploads    
      @album = @page.albums.detect do |a|
        a.name == 'My albumm'
      end
      @album.photo!(
       :message => 'Upload Photo via URL'
      )

Aditya Gada

unread,
Nov 1, 2012, 7:27:56 AM11/1/12
to fb_g...@googlegroups.com
Could anyone help me with posting a photo to a user's profile while having that photo displayed on the user's timeline?

Thanks!

nov matake

unread,
Nov 1, 2012, 7:53:32 AM11/1/12
to fb_g...@googlegroups.com
Probably you are posting photos using a user's access token.

Try this.

===
# Obtain Page's access token using page owner's access token first
page = FbGraph::Page.new('FbGraph').fetch(:access_token => ACCESS_TOKEN, :fields => :access_token)

# Post a photo using the page's token
page.photo!(
  :source => File.new(File.join(File.dirname(__FILE__), 'fb_graph.png'), 'rb'),
  :message => 'Hello, where is photo?'
)
===

Aditya Gada

unread,
Nov 1, 2012, 8:10:07 AM11/1/12
to fb_g...@googlegroups.com
If i posted using the user's token, the pictures wouldn't get uploaded to the page's album.
Pictures gets uploaded to the page's album by :

      @me = FbGraph::User.me(session[:fb_access_token])

      @page = @me.accounts.detect do |p|
        p.name == 'Fans of Fast cars'
      end

      album = @page.albums.last
      album.photo!(
       :message => 'Upload Photo via URL'
      )

But its not showing up in the Page's Timeline.

I also want to picture to be shown in the timeline whenever the picture is uploaded from the app.


And : which access token should i use for ACCESS_TOKEN ? page or user?
page = FbGraph::Page.new('FbGraph').fetch(:access_token => ACCESS_TOKEN, :fields => :access_token)


nov matake

unread,
Nov 1, 2012, 8:27:24 AM11/1/12
to fb_g...@googlegroups.com
ACCESS_TOKEN is user token.

I used this code to post a photo into a page's album, and the photo is on the timeline.

===
page = FbGraph::Page.new('FbGraph').fetch(:access_token => ACCESS_TOKEN, :fields => :access_token)

album = page.album!(
  :name => 'FB Graph Album generated via Graph API'
)

album.photo!(
  :source => File.new(File.join(File.dirname(__FILE__), 'fb_graph.png'), 'rb'),
  :message => "Posting to #{album.name}"
)
===

ps.
I also posted your photo and saw a sexy lady on the page's timeline :p

Aditya Gada

unread,
Nov 1, 2012, 8:36:16 AM11/1/12
to fb_g...@googlegroups.com
Why doesn't the photos i upload go to the page's timeline ?
I think there will be some privacy options set.
does it require any other permissions other than the "manage_pages" permission ?  

Yeh she's beautiful <3

nov matake

unread,
Nov 1, 2012, 9:34:30 AM11/1/12
to fb_g...@googlegroups.com
Hum, I think Graph API will reject the http request itself if it's permission issue.
Can you ask FB developer support for more details?
I have no idea why the behavior is different on your side..

d8au...@gmail.com

unread,
Apr 6, 2014, 10:42:18 PM4/6/14
to fb_g...@googlegroups.com
Hi all,
I have the same problem when post photo to facebook
This is my code:

page = FbGraph::Page.new(identifier, :access_token => session[:user_token])
page.photo!(
        :source => File.new('/home/dondinh/Desktop/13-1369-1391474513.jpg', 'rb'), # 'rb' is needed only on windows
        :message => 'Hello, where is photo?'
      )

And error message: "OAuthException :: An unexpected error has occurred. Please retry your request later. page.photo!"
Please help me
Thanks
Message has been deleted

NuDon Dinh

unread,
May 5, 2014, 10:40:14 PM5/5/14
to fb_g...@googlegroups.com
Hello all,
I created album's group facebook. I have following Nov Matake's instruction and I got error:

OAuthException :: (#10) Application does not have permission for this action


This is my code:
page = FbGraph::Page.new(page_id).fetch(:access_token => user_token)
  album = page.album!(
    :name => 'FB Graph Album generated via Graph API'
  )
This my config:
publish_actions, user_groups, user_likes, user_photos, photo_upload, publish_stream, manage_pages

I don't know why :(
please help me
Thanks all
Reply all
Reply to author
Forward
0 new messages