angular-easyfb
angular-easyfb copied to clipboard
Upload photos from camera source
I have installed ezfb and tested you demo for posting a "feed". I've spent the past two days trying to find a solution to why I can't upload a photo from data created with a camera canvas. I have tried canvas.toDataURL( mySource ), tried converting it to a Blob and attaching it to ezfb.api( source: myblob) but nothing seems to work other than saving the image to a file on a public IP address and then using the FB URL parameter rather than the source. I have done a lot of reading about FB wanting a multipart form but I have not found anyway to create that in ezfb.
Not that it should matter but I'm developing on http://localhost/myDomain and storing the images on my local hd does not get the job done... the url parameter seems to only work from a public domain/ip address - not localhost.
A working sample of this task would be really helpful!
For the SPA I'm developing, it would suck if the client can't post a photo from their camera without first getting storage space on a public server....
Thanks in advance.
Found a solution... would be nice if this functionally was included in your library. Here is a link: http://stackoverflow.com/questions/35845623/uploading-a-canvas-image-to-facebook-as-blob-of-multipart-form-data-type and it includes a working jsFiddle!
Hi @Harvey-Mushman ,
Glad that you finally get the answer, it seems that Facebook sincerely don't want JS developers upload images directly to their APIs.
angular-easyfb
tries to be only a wrapper around Facebook's JavaScript SDK, hence there's no plan on adding any additional functionality beyond the JS SDK. Appreciated for the advice!
Thanks for responding. And yes, the post on Fiddler works in combination with your ezFB.
I just wonder if I’m are missing something in your reply… it is not the FB SDK that is functionality incomplete but the EZFB library that seems to be lacking a richer interface to communicate with Facebook.
If you consider the iOS or Android SDK’s they both accept bit streams directly from the smartphone that is posting to Facebook – right? Thinking about it differently, when was the last time you used your smartphone as a camera, stored the picture on a public domain and then back into your FB app on the phone and uploaded a photo. This is a lot of extra steps for the end user who may or may not have a public domain in the first place.
If you further inspect the Fiddler code (https://jsfiddle.net/ilyador/vyne7oh2/8/), you will notice the Facebook post is still using the FB SDK without any special tricks of gimmicks. The only difference is the way the data is packaged on the client side when the photo data comes from memory (HTML5 Canvas). The trick is to use the JavaScript new XMLHttpRequest() object on which you build the request that ultimately gets posted back. XMLHttpRequest allows Multipart posts which is the specification Facebook calls out in their documentation for posting “source” data.
In my opinion this should be a basic feature of any AngularJS library since it is supported by Facebook.
All the best, Harvey
From: Chih-Hsuan Fan [mailto:[email protected]] Sent: Wednesday, March 30, 2016 2:10 AM To: pc035860/angular-easyfb Cc: Harvey-Mushman Subject: Re: [pc035860/angular-easyfb] Upload photos from camera source (#64)
Hi @Harvey-Mushman https://github.com/Harvey-Mushman ,
Glad that you finally get the answer, it seems that Facebook sincerely don't want JS developers upload images directly to their APIs.
angular-easyfb tries to be only a wrapper around Facebook's JavaScript SDK, hence there's no plan on adding any additional functionality beyond the JS SDK. Appreciated for the advice!
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/pc035860/angular-easyfb/issues/64#issuecomment-203336926 Image removed by sender.