HTML5 Canvas to Facebook - facebook-graph-api

I've made a basic HTML5/JS comic creation tool that uses the canvas element.
I want users to be able to upload their comics via the Facebook API.
I don't believe Facebook allows posting images in the form of base64 strings from the canvas.toDataURI() method, and don't want to use my own server to convert these images & temporarily store them.
What's the best way to go about this? Possibilities I've wondered about: Convert canvas to blob? Store blob via web service (if so, suggestions?) Upload blob directly to Facebook? (Is that possible?)

I don’t see why this should not be possible doing a „normal” upload. You can create a new photo for a user by posting to PROFILE_ID/photos, with a source parameter of type multipart/form-data.
So first thing I’d try is getting the picture info from the canvas object into a „normal” form (writing it into a input element in the right format(?)), and sending that to Facebook. If this step succeeds, I’d see if jQuery or some other lib’s form.serialize method can build requests of type multipart/form-data. If that’s also possible, then there should be no further problem in taking the data in that format and posting it using FB.api (although you might want to tell your users to be patient, because that might take a while).
Can’t tell for sure if this’ll work, but I’d give it a try.

Facebook partners with Heroku for free app hosting, you can use it as the temporary server.

Related

Add video to timeline from GDK or Add "Share" to live card

I'm using the GDK with XE16
I would like to save a video using MediaRecorder and then put it on the Timeline so I can let the user share the video to Gplus, YouTube or any contact. I am providing some additional information during the recording process as an overlay on the video preview.
I am able to save the videos into the /mnt/sdcard/Movies path. I am invoking the Intent.ACTION_MEDIA_SCANNER_SCAN_FILE to add the recorded video to the media database.
I have not been able to figure out how to add a share intent to on livecard. The previous API supported static cards, but those did not support video attachments; and the API is no longer available. I have also tried to use AccountManager and the com.google account in Glass to get an ouath token for the Mirror api to write direction via oauth2:https://www.googleapis.com/auth/glass.timeline. The authorization request shows up, but it is impossible for the user to accept the request.
I've considered sending the video file back to a proxy server that will then call mirror, but this seems like a big round trip for nothing.
I suppose I could send the credentials through this proxy, but this seems like a security nightmare.
The difference between Static Cards and a Timeline Item were large enough that the team, apparently, removed Static Cards until they could make the two of them work much more similarly. What you're trying to do is a commonly requested, and it does make sense that both should work mostly the same way.
You're on the right track for how to handle this at the moment - use the Mirror API to get it into the timeline as a Timeline Item. As you've noticed, you can't go through the auth flow since the user is unable to authenticate through Glass directly.
While you're testing, you can code in an auth token and a refresh token to be provided to the library to do this. For production through MyGlass, take a look at the auth flow that is available at https://developers.google.com/glass/develop/gdk/authentication

Django and Post to Facebook (no authentication)

OK, I need some help understanding the process behind Facebook's website integration process and how I can integrate it into my web app....
In its most basic form, my site stores and displays users' comments about products (there's more to it than that, but that's all that's relevant for this question). What I'd like to do is allow them to post that comment, together with the name of the product (and my site), to their Facebook wall by clicking a button.
I do not need the users to log in to my site at all, either with Facebook or any other authentication system and the Post to Facebook part is optional.
Obviously if they decide they do want to post their comment to Facebook, then they'll need to login, but I'd rather temporarily take them away from the page to login, post and then be brought back to my site.
What I need to know is how much of Facebook's APIs, Open Graph and Auth systems do I actually need to integrate?
I had hoped that I might be able to generate a simple link to Facebook with their comment embedded as a POST element...?
I'd be really grateful if someone could point me in the right direction!!
(P.S. I need a similar solution for Twitter, but I think that's easier!?!)
The Feed Dialog doesn’t allow including of a pre-set message any more, so you’d have to make that post via the Graph API if you want to pre-fill the message (and even then, you should only do so, if you’ve given the user the possibility to edit the pre-filled message first).
See here for how to make a post on a user’s behalf via Graph API, https://developers.facebook.com/docs/reference/api/user/#posts
You can do that all client-side, if you embed the JavaScript SDK into your page.
You need to set up an app on FB, then have the user connect to it (using FB.login), ask for the necessary permission (publish_stream) while doing so, and after successful login use FB.api to make the Graph API call.

Clarity involving Graph API Permissions

Sorry. Pretty new to this and trying to get a grasp on getting extended permissions/access_token for what I am trying to achieve.
All I need is to pull the public profile feed from someone's facebook page (returns in json format) so I can display it on said person's website. (I was going to parse this information using Jquery)
I think I understand that I will need to create an app in order to do this. Now will I need to create an app from said person's facebook account? Or is that something I can do myself, as a separate app?
Thanks for any info you can give on this.
You could in do it from both.
However im not 100% certain on if you would need any extra permissions from the target user or not. Because it is a public feed I would think not, but I haven't tried this myself so I can say for certain.

Can I have my app scan my Twitter stream for news to show the user?

I would like to be able to show short news messages to users of my app. I am thinking the nicest way to do this would be to add a hashtag (like #appnews) to my Twitter updates that I want shown in-app; my app will make this happen by scanning my Twitter stream at startup and surfacing updates with that hashtag. This seems super-simple, and I'd like to know if there's some way to do this via built-in (HTTP?) calls to my Twitter page, rather than incorporating a whole framework like MGTwitterEngine. The user will not be logging in or posting Twitter updates at any point.
Thanks!
You can retrieve any user's public tweets in XML format by retrieving the following URL:
http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=DWRoelands
(This example will display my tweets). Once you've got the list of tweets, you can parse through the XML document in whatever way is easiest for you.
Rather than tagging posts with a hash tag, I would recommend simply starting a new Twitter account that is solely for the news items you described.

Django url image extraction like facebook

Does anybody know if there is a pluggable app that you can use to achieve url like image extraction for Django?
I dont know if there is a pluggable app that will do this for you, but you can probably hack this together yourself.
The only 'standard' I know of that facilitates this is oEmbed (http://www.oembed.com/) which basically works this way:
somebody gives you a URL.
you read it, find that its a valid JSON that matches the oembed structure
success!
other than the above, and what I think facebook does as well (since I took a look at a few sites that both twitter and fb would work with and none have any oembed support that I can see), is to work on a case by case basis. They probably had a developer go through a large variety of sites and look at the type of meta tags available. for example, yfrog has a bunch of meta properties that tell you the url directly to the main image being displayed, the owner, the tweet that went along with the image, etc. After that it's best effort guesswork. that's why when you try to share a blog post on facebook, it'll often give you the option of any one of the images that went with that blog post, because it doesn't know which one is the main one.