最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

api - How do I programmatically upload pictures to facebook? - Stack Overflow

programmeradmin0浏览0评论

Ok, so here was my first question: How do I allow visitors on my site to share my photos on their facebook news feed?

After implementing it I realized what I really want is to upload the image as a photo to their photo album.

How would I got about getting an image on my site, to upload to their photo album, when they click on a facebook icon next to the image?

Any thoughts at all are appreciated.

Thank You.

Ok, so here was my first question: How do I allow visitors on my site to share my photos on their facebook news feed?

After implementing it I realized what I really want is to upload the image as a photo to their photo album.

How would I got about getting an image on my site, to upload to their photo album, when they click on a facebook icon next to the image?

Any thoughts at all are appreciated.

Thank You.

Share Improve this question edited Apr 13, 2017 at 12:57 CommunityBot 11 silver badge asked Dec 13, 2010 at 5:48 Greg McNultyGreg McNulty 1,4665 gold badges28 silver badges50 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 4

Register your application at Facebook (create a Facebook app).

Authenticate the user with Facebook, at the same time user approves your app access.

Use Facebook publishing api to upload image (follow link, look for Publishing title).

First make sure that you are authorized to publish to the user's feed with the publish_stream permission.

Then use the api mands to send the photo to the server.

Here's an example using the Branches FB API:

Dim FB As New SessionInfo("[access_token]")
Dim Posts = New Functions.Posts(FB)
Dim img As String = "[Local picture Location]"
Dim F = New IO.FileStream(img, IO.FileMode.Open, IO.FileAccess.Read)
Dim B(F.Length - 1) As Byte
F.Read(B, 0, B.Length)
F.Close()
Dim PhotoID = Posts.PublishPhoto("[Album ID]", "[caption]", true, B, [Optional Tags if any])    

Tagging users is similar, just pass in a tag list when you call PublishPhoto

 Dim TL As New List(Of Tag)
 Dim T As New Tag
 T.id = "[userID]"
 TL.Add(T)
 Dim PhotoID = Posts.PublishPhoto("["me" or Album ID]", "[caption]", true, B, TL)    
发布评论

评论列表(0)

  1. 暂无评论