Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programmatically upload pictures to facebook?

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.

like image 336
Greg McNulty Avatar asked Dec 13 '10 05:12

Greg McNulty


People also ask

How do I automatically upload photos to Facebook?

Click on 'Photos' - there you'll find three tabs - Photos of You, Albums, and Synced. Tapping 'Synced' will take you to a window where you can turn automatic uploading on. All your photos will begin to be automatically uploaded, but Facebook does limit you to just 2GB worth of photos.

Can I upload photos from Google to Facebook?

Once you upload and store photos and videos in Google Photos, you can share from Google Photos to Facebook friends easily. Because Google Photos is fully and completely integrated with various social media platforms.


2 Answers

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).

like image 146
Ali Shakiba Avatar answered Oct 04 '22 02:10

Ali Shakiba


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

Then use the api commands 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)    
like image 33
Middletone Avatar answered Oct 04 '22 04:10

Middletone